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).