[SOLVED] How do I reset many glob vars except a few?

0 favourites
  • 3 posts
  • hello! In the manual I have found:

    System expression - Restart layout

    Restart the current layout. Note that unlike Go to layout, this action resets all event groups to their initial activation state. Global variables keep their current value - they are not reset. To reset them use the system action Reset global variables.

    What would be a good practise to reset all event groups, and most global variables, except a few (for example how many times you have won the game).

    I can only think of using Local Storage.

    What is your advice?

  • If you want to preserve some values after the "Reset global variables", there are a few ways to do this -

    • you can make a static local variable in an event group. Static local variables are not reset.
    • you can create an instance variable on a global object (array for example), or create a dummy object (empty sprite) and set it as global
    • store it in an array or dictionary
    • save in Local Storage
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you for your reply!

    I did not know about static local variables not being reset.

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