Page 1 of 2

How to save game on computer?

PostPosted: Sat Dec 22, 2007 6:19 pm
by Sondise
How to save game on computer? I need it because my game has 82 levels ( :shock: ).

Re: How to save game on computer?

PostPosted: Sun Dec 23, 2007 1:57 pm
by asmodeus
Either you use variables that you save in groups (screenshot) and use the loadVars() and saveVars() functions or you use a file.

Re: How to save game on computer?

PostPosted: Sun Dec 23, 2007 3:45 pm
by Sondise
i didn't understand. Could explain better please? :mrgreen:

Re: How to save game on computer?

PostPosted: Sun Dec 23, 2007 4:41 pm
by Spidy
asmodeus wrote:Either you use variables that you save in groups (screenshot) and use the loadVars() and saveVars() functions or you use a file.


he is not saying that he said mean i reach in level 13 than i saved the game then i close it then again i run the game and load the game

Re: How to save game on computer?

PostPosted: Sun Dec 23, 2007 5:09 pm
by asmodeus
If you want to save in which stage you are, create a variable and call it stage. Save it in a group and call it mygroup.
If you are in stage 1, set the variable to 1.
Code: Select all
stage = 1;

If you want to save it use this code:
Code: Select all
saveVars("myfile", "mygroup");

You can write any name instead of myfile. To load the variable use this code:
Code: Select all
loadVars("myfile", "mygroup");

I hope this helps. :D

Re: How to save game on computer?

PostPosted: Sun Dec 23, 2007 6:32 pm
by Sondise
Ok, but how can I explain to the program, the variable number (1, 2,...)

Re: How to save game on computer?

PostPosted: Sun Dec 23, 2007 10:20 pm
by Letchford
It loads them and there values. Not just the variables! So when you load a variable it is loading the value too! :D

Re: How to save game on computer?

PostPosted: Sun Dec 23, 2007 10:47 pm
by Sondise
What's "myfile"?

Re: How to save game on computer?

PostPosted: Mon Dec 24, 2007 8:06 am
by Spidy
Sondise wrote:What's "myfile"?

put there your stage file.

Re: How to save game on computer?

PostPosted: Mon Dec 24, 2007 1:47 pm
by Sondise
Could anybody send me a demo, please, I'm not understanding! Please!

Re: How to save game on computer?

PostPosted: Mon Dec 24, 2007 1:51 pm
by makslane

Re: How to save game on computer?

PostPosted: Mon Dec 24, 2007 2:02 pm
by asmodeus
Here is an example.

Re: How to save game on computer?

PostPosted: Mon Dec 24, 2007 4:59 pm
by Sondise
Yeah, but I wouldn't like to save the actor's positions, i'd like to save its progress in game, for example, in each level there's a crystal and a gem. If i catch the crystal, an actor who blocks the other level will be destroyed, if I close, I'll still have the crystal and the actor destroyed. If I catch the gem, I'll have the gem, and that's it. :?:

Re: How to save game on computer?

PostPosted: Mon Dec 24, 2007 5:02 pm
by Sondise
just, it, not the lives, or energy, just progress.

Re: How to save game on computer?

PostPosted: Mon Dec 24, 2007 5:05 pm
by asmodeus
Create a variable and call it got_diamond. If you caught the diamond, change the value to 1.
Code: Select all
got_diamond = 1;
saveVars(...);

If you start the game use this code:
Code: Select all
loadVars(...);
if(got_diamond==1) DestroyActor("diamond");