[SOLVED] Save/Load State Problem


#1

Ok, I have a problem.
This is the situation- when the player is at the end of level 1, he is in collision with tile marker – action save in storage.
Then at the start scene when you hit play, and if you finished first level (as I described earlier) you can choose level 1 or level 2. In preview within gdevelop its working, but in exported game it does not…
So this is my events.

START scene


Level 1 scene

Anyone know whats the problem? Does the storage delete itself on scenes restart, and if so, do I need some kind of global variable to do this…?
Thanks


#2

If your game runs on a smartphone (Android) I have used these commands and saving and subsequent reading works fine.
For details, also read the GDevelop Wiki


#3


#4

Thanks Salvatore. I will try something similar, but the problem is that I cannot test it many times as I have limited number of export…


#5

That can be fixed by getting a subscription :slight_smile:. It only costs a couple of dollars a month, and I suspect helps to pay for the GDevelop servers.


#6

Yes I totally agree with you MrMen. I will definitely get subscription when I make some money from my games, but until then…i will delete storage at the beginning of the scene. :laughing:
Anyway, I managed to work this out.
If anyone need this:
I changed that when player hit save tile at the end of lvl1 make a text in storage.
Then in start scene - at the beginning read value of text (for example “level1”) of that storage and store it to scene variable.
Then if you hit play and the text of scene variable is “level1” then choose level scene appears.
If there isn’t text “level1” in the scene variable (inverted) then start normally…
Thanks everyone :wink:

EDIT:
On windows export, this method is not working when you close the game. :frowning:
Ah well…


#7

Thanks for sharing your solution :smiley: