How do I reset all static variables?

  • Maybe I'm sleep deprived, but I don't believe there's an easy way to reset all static variables, as there is with globals.

    Why do I need to do this? Many of my "global" variables are actually static variables in an 'Every Tick' (which I use to limit their scope to the event sheet they belong in). Now, just as I can reset global variables, I need to reset static variables. What should I do?

    I would hate to store each variable in a key and reload. There's gotta be a better way! Any ideas?

  • Maybe you can use the function object?

    on function "resetVariables"

    • set variable x to ??
    • set variable y to ??
    • set variable z to ??

    Then call the function each time you need to reset the variables.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Because they are static variables, the Function object won't be able to access all the static variables that are spread across events.

    EDIT: Nvm, of course it can! Function is a trigger that can be placed in multiple places. I was running on very low sleep

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