Here is a quick example of what you want to do. The points to note are the calls to saveVars, and loadVars. Each time you defeat all the enemies in the wave, it calls the nextWave function in global code.
- Code: Select all
void
nextWave()
{
int i;
int j;
for(i=0;i<6;i++)
{
for(j=0;j<level+1;j++)
{
CreateActor("enemShips", "icon", "(none)", "(none)", view.x+120+i*60, view.y+120+j*20, true);
}
}
saveVars("save","save");
}
The call to saveVars will only happen each time you go to the next level and it will save the amount of lives you have, health, your score, and what level you are on. Now to load a game, you would use the code in the create actor event of the view.
- Code: Select all
loadVars("save","save");
nextWave();
If you want the player to be able to select load game from a menu, you would move the loadVars to that, and trigger the new wave of enemies. Essentially this is just the normal method of saving, except you automate the process instead of having the player click a save button.