Is there a way to reset static variables?

  • How do we reset static variables to their default (initial) value?

    I'm making a function that delete the savefile (since Construct doesn't provide an easy way to do so, which would be very useful btw ).

    My "deleteSavefile" function does the following:

    • Clear local storage
    • Reset global variables to default
    • Reset persistent objects
    • Send the player to the title screen

    What I can't figure out how to do is to reset the static variables to their initial values. Right now, after calling this function, the player is sent to the title screen, but when clicking "New Game", it's not really a new game, because all static variables kept their values.

    You folks have any tips for me? Thanks

  • I'll guess you'll have to go the manual way. Set their initial value using a function and call that function whenever it's needed. Like when you are resetting the save.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ah, really? That's annoying :S

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