How do I save the game state

Get help using Construct 2

Post » Tue Apr 25, 2017 6:42 pm

I'm developing a graphic adventure and now i need to find a way to save the room so when the game starts will not build the level from the beginning each time. I have all the start configuration in an XML file with all the text strings. I should check, at start of layout, if is the first time that game starts and if not, skip first configuration and, instead, loading it from local storage. Wich is the best way to do it?
Thanks!
B
6
S
1
Posts: 73
Reputation: 569

Post » Tue Apr 25, 2017 8:43 pm

Option 1 - System save and load actions - https://www.scirra.com/tutorials/526/ho ... -savegames

Option 2 - Localstorage - An entire array or dictionary object holding values you wish to save can be written to a single localstorage key as JSON. That key can be checked on start of layout to see if it exists.
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303

Post » Tue Apr 25, 2017 8:44 pm

https://www.facebook.com/TeslaPCgames

https://www.twitter.com/TeslaPCGames

[email protected]

http://www.synergy-studios.net
B
33
S
17
G
58
Posts: 109
Reputation: 31,714

Post » Thu Apr 27, 2017 8:23 pm

I must thank you both... you gave me great help, thanks! :)
Trying now..
B
6
S
1
Posts: 73
Reputation: 569

Post » Thu Apr 27, 2017 9:32 pm

mmmh, not sure that save and load feature can be used with Local Storage
My game should auto-save after every action taken, but the
'LocalStorage --> On item "autosave" exists' does not seem to work, if Autosave was created with "Save" action...
B
6
S
1
Posts: 73
Reputation: 569

Post » Thu Apr 27, 2017 9:35 pm

They are completely separate systems...
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303

Post » Thu Apr 27, 2017 10:46 pm

Local storage is for keep values like bestscore, lastuser, etc.

I think save and load is for this case.

https://www.youtube.com/results?search_query=save+and+load+construct+2
https://www.facebook.com/TeslaPCgames

https://www.twitter.com/TeslaPCGames

[email protected]

http://www.synergy-studios.net
B
33
S
17
G
58
Posts: 109
Reputation: 31,714

Post » Thu May 04, 2017 4:27 pm

Yes. i'm trying to use that one. Seem to work :)
B
6
S
1
Posts: 73
Reputation: 569

Post » Sat May 20, 2017 8:58 am

TeslaPC wrote:Local storage is for keep values like bestscore, lastuser, etc.

I think save and load is for this case.

https://www.youtube.com/results?search_query=save+and+load+construct+2


I think i'll use Save Game only in test environment, because i noticed some limits. for example, i didn't find a way to check if a savegame exist (but maybe i'm doing something wrong)
Then i noticed something weird if i close game during a "wait" inside a function...
I think i'll finally use local storage to save the Array and Character position :)
B
6
S
1
Posts: 73
Reputation: 569


Return to How do I....?

Who is online

Users browsing this forum: David181, InfiniteRockets and 16 guests