Simple code for save/load?


Please can anyone help me?

I´m making clicker game for android on 1 scene.

I need the whole game and progress to save automaticly for example every 10 sec and when the game quit.

And load everything automaticly again when it launches.

Is there any simple action to make it work?

I was looking for answer, but I dont understand how to save whole progress with one code.

Thank you very much

There’s no straightforward way to save and load with just one code. I suggested a feature for this, but I’m not sure if they’ll add it. To save and load, you’ll have to watch tutorials on YouTube.

Make Global variable called Save and make it structure
Now you add child variables to it for whatever you would wish to save
Imagine you want to save sound volume
So you add called VolumeSound to it
And so you would call it by GlobalVariable(Save.VolumeSound)

Now let’s say you want to save Score
So you add child number variable called Score
And so you would call it by GlobalVariable(Save.Score)

And so go on
And trick to it is that you only now save Save variable and it will save with all it child variables

For what you ask you could use condition
To compare current time with some number and save if its equal

What mod does is cycle trough amount of numbers you specify as last number in this expression in this case 10
But it does not go trough 1 2 3 4 5 6 7 8 9 10
It goes trough 0 1 2 3 4 5 6 7 8 9
Since starting number is always 0 not 1

And so We Take Time(“sec”) which is current seconds of your device time
And cycle it around 0 to 9
And with condition you see on screenshot (its called compare two numbers) i check if it is equal to 1
And if it is i play sound
While i add trigger once to it so it does not spam that sound
And you can check it here
In upper right each time you see 1 as last digit it will play a sound
Just click somewhere 1st because browsers require you to click inside game for it to be able to play sound

Where for loading you would simply use condition at beginning of the scene to load your variables
And how to save and load is in post below

Okay, thank you very much. I will try and hope that I can make it work. :slight_smile: