How do I autosave without a button?

0 favourites
  • 3 posts
From the Asset Store
In this template the music plays without looping in your game
  • Hi,

    I love the Save&Load functions but I have trouble using them. I would like the levels in my game to stay locked/unlocked whenever the user quits or launches the application without the need for them to press a 'save game' button. Is there a way to do this?

    I can't do BOTH auto-load and auto-save using triggers in the menu because it will create a loop or not work as intended. The ideal situation would be to detect a 'on first start of layout' (load) and a 'on game quit' (save) events, but there are no such things. Any ideas?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Can't you just save/load to webstorage and use a global var to ensure the load function only runs once?

    In terms of saving, if all you're doing is keeping track of levels cleared, it's a trivial matter to just update your save whenever the player beats a level. Assuming you are using an array, even with a few hundred levels, the overhead is trivial even on a weak device.

  • I think your're right. Actually it's even simpler than an array - I'm just saving the number of the max unlocked level in a variable.

    [Edit] Works like a charm. Thanks! I'm no beginner to C2 but I never needed WebStorage before. Now that I discovered how hassle-free it is I'm actually excited!:)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)