How Do I save and load state slots using webstorage

Get help using Construct 2

Post » Sat Apr 04, 2015 6:40 am

Hi, I'm trying to make a multiple save/load game slot system in a separate layout and I've figured out the basic system to use the system action "Save" to save the game's State before leaving the main layout, then go to a menu screen layout and then to a save/load game layout. The saved SaveState should still be available to be saved to a game slot selected by the player and loaded later. But I need to know a little more in order to save a game state to one of many slots and then call a particular slot later to load that game state.

The topic, "How to make savegames" touches on this, but doesn't go into any detail. Is the "SaveStateJSON" the actual file saved in the browser on the system action: Save, which could then be called using the WebStorage.LocalValue(SaveStateJSON) expression? It says something about triggers needed to access the SaveStateJSON. Can I do something like: On button touched---> Webstorage: set local key "Save" & SlotNum to SaveStateJSON ? I see plenty of examples of saving variables to webstorage, but none showing how to save and then retrieve a savestateJSON using webstorage, which I could then use the action: load from JSON to go to load the game.

I'm guessing that to load the SaveState I have to do something like: On LoadButton touched: If WebStorage local key "Save" & SlotNum exists-->Webstorage: set local storage from JSON string "Save" & SlotNum, and then action "Load Game from JSON string: Webstorage.LocalValue(SaveStateJSON) . However this isn't working so far.
Posts: 29
Reputation: 264

Return to How do I....?

Who is online

Users browsing this forum: AllanR, BackendFreak, farsen, Prominent, R0J0hound and 33 guests