groups and variables

Non-platform specific questions.

groups and variables

Postby ESL » Thu May 31, 2012 12:46 pm

I am not getting something about the groups and variables. I want to make it so that all my character with separate names are in the same group. They all follow the same actions along different paths. When they are are destroyed,the screen goes to a new view.
ESL
 
Posts: 96
Joined: Mon Jun 28, 2010 2:05 am
Score: 1 Give a positive score

Re: groups and variables

Postby skydereign » Thu May 31, 2012 3:43 pm

All variable groups do are put the variables into a single group, so you can use the saveVars function to save them all at the same time. If you want actors to act the same you can either make them the same actor, use inheritance/parenting, or some other form of control. What do you mean they follow the same path? Do they follow it at the same time? Are you using actual paths?
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: groups and variables

Postby ESL » Fri Jun 01, 2012 11:49 am

They are different characters following the same path. When they are all destroyed, the game moves to the next level.
ESL
 
Posts: 96
Joined: Mon Jun 28, 2010 2:05 am
Score: 1 Give a positive score

Re: groups and variables

Postby skydereign » Fri Jun 01, 2012 4:05 pm

Well if you are using paths, and you destroy the actors when the path finishes, you can either check if the other actors exist (if not move to the next level) or you can increase some variable. That way you can check to see how many have been destroyed, and if it is the right amount, move to the next level.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: groups and variables

Postby ESL » Mon Jun 04, 2012 5:48 am

I don't understand how to use the groups and variables. To me, a variable is a number that changes in relation to an another number changing. I envision a group as being contained in a box.
ESL
 
Posts: 96
Joined: Mon Jun 28, 2010 2:05 am
Score: 1 Give a positive score

Re: groups and variables

Postby skydereign » Mon Jun 04, 2012 3:59 pm

Variables and groups have nothing to do with the problem you were asking about. Variable groups are only used for saving and loading. Just say you declared these variables.
lives
score
jump

Now if you wanted to be able to save lives and score, you would need to put them into a save group. You could put them into separate save groups, but that means you have to save and load the variables separately. For instance, saving would look like this.
Code: Select all
saveVars("lives_file", "lives_save");
saveVars("score_file", "score_save");

But, there really isn't a reason to save them and load them independently. So, if we put them into the same save group, you can just call the saveVars to save all variables you put into that group.
lives (in game_save group)
score (in game_save group)
jump
Code: Select all
saveVars("save_file", "game_save");

So, the only actual use for variable groups is bunching together variables for the saveVars and loadVars functions. Using your box comparison, saveVars and loadVars can only save boxes, they can't save individual variables. So, if you put all the variables you want to save within one box, all you have to do is call saveVars and loadVars on that one box (instead of putting each variable into its separate box).
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: groups and variables

Postby ESL » Fri Jun 08, 2012 2:42 am

How do I put all the characters into the same group?
ESL
 
Posts: 96
Joined: Mon Jun 28, 2010 2:05 am
Score: 1 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron