LoadVars and LoadGame, Start Menu

Game Editor comments and discussion.

LoadVars and LoadGame, Start Menu

Postby peedalein » Wed Jun 08, 2011 11:47 am

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!
peedalein
 
Posts: 54
Joined: Mon May 17, 2010 2:26 pm
Score: 1 Give a positive score

Re: LoadVars and LoadGame, Start Menu

Postby Jagmaster » Wed Jun 08, 2011 12:48 pm

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
User avatar
Jagmaster
 
Posts: 875
Joined: Sun May 08, 2011 4:14 pm
Location: Not where you think.
Score: 82 Give a positive score

Re: LoadVars and LoadGame, Start Menu

Postby peedalein » Wed Jun 08, 2011 1:41 pm

Thanks. I forgot that variables are stored outside of the .ged files.
peedalein
 
Posts: 54
Joined: Mon May 17, 2010 2:26 pm
Score: 1 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest