Loading the next level using strcpy - help!
Posted: Thu Mar 29, 2012 11:14 pm
I'm trying to get the following code to work but it keeps sending me back to the start menu, not level 2 (level02.dat).
I've set up the following Variable on both levels
SaveLevel
Integar
Global
Array: no
Save group: data
Level01 I set up the following:
Global script
Collision - script
Score screen I set up
Global script
Keydown - script (to start the level)
I set up a Text Actor to see if "level" did in fact = 2 and it does, so the var code is good.
I've set up the following Variable on both levels
SaveLevel
Integar
Global
Array: no
Save group: data
Level01 I set up the following:
Global script
- Code: Select all
int level;
Collision - script
- Code: Select all
level = 2;
SaveLevel = level;
saveVars ('game.sav", data");
Score screen I set up
Global script
- Code: Select all
int level;
int loadlevel;
Keydown - script (to start the level)
- Code: Select all
loadVars ("game.sav", "data");
level = SaveLevel;
if (level = 2);
strcpy("loadlevel", "level02.dat");
if (level = 3);
strcpy("loadlevel","level03.dat");
if (level = 4);
strcpy("loadlevel","level04.dat");
LoadGame("loadlevel");
I set up a Text Actor to see if "level" did in fact = 2 and it does, so the var code is good.