Page 1 of 1

LoadVars and LoadGame, Start Menu

PostPosted: Wed Jun 08, 2011 11:47 am
by peedalein
Greetings,


I created a game in which I save several variables throughout the game. Thus, once the player exits and relaunches the game, he can resume the game.
The saved variables are loaded when the player starts the game.


I created a start menu for my game. The start menu is a seperate .ged file. In the start menu, the player can choose between "New Game" and "Continue Game".
My idea is to load the game .ged file once the player clicks on "New Game" or "Continue Game". Unfortunately, in both cases this loads the game with the saved
variables.

Is there a way to modify LoadGame so that it drops the saved variables? Or is there a way to trigger loadVars from another .ged file? Or do you know any other solutions


Thanks for your help!

Re: LoadVars and LoadGame, Start Menu

PostPosted: Wed Jun 08, 2011 12:48 pm
by Jagmaster
For New game:

Code: Select all
Variable=0;
Savevars(group, file);
loadgame(game)

on the startup of the game,
Code: Select all
Loadvars(group file);
if(Variable==0)
{
//do not load game
}
else
{
//load game
}


when you save variables, be organized with your groups. This way, you won't have them all loaded at the same time.
scores, heath and position go in a group called "Status"
Loadgamestate? goes in another group.

Hope this helps. :D

Re: LoadVars and LoadGame, Start Menu

PostPosted: Wed Jun 08, 2011 1:41 pm
by peedalein
Thanks. I forgot that variables are stored outside of the .ged files.