How Do I save and load state slots using webstorage

0 favourites
  • 1 posts
From the Asset Store
State Machine
$10.99 USD
State Machine is a great tool for managing the state of anything in your game.
  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)