Difference between GLOBAL & LOCAL Variables?

0 favourites
  • 3 posts
From the Asset Store
"Easy Local Notifications" enhances games with customizable local notifications.
  • As the title says, just discovered that when i drag down the global variables to a group or single event it becomes a local one, ive worked with instance variables and global variables only, whats the difference with the local variables?

  • See this chapter from the manual:

    scirra.com/manual/83/variables

    Local variables are often used when you need a "temporary" variable in an event for some calculations. Note, that local variable is reset on the next tick, so if you use "Wait" in the event, the variable will be reset after it.

    If you need the variable to not reset, you can set it as Static. For example, you can create an event group Audio, add local static variable MusicVolume there. This variable will only be accessible inside the Audio group (which is good, because you don't need it anywhere else) and it will not be reset even if you reset all global variables.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • See this chapter from the manual:

    https://www.scirra.com/manual/83/variables

    Local variables are often used when you need a "temporary" variable in an event for some calculations. Note, that local variable is reset on the next tick, so if you use "Wait" in the event, the variable will be reset after it.

    If you need the variable to not reset, you can set it as Static. For example, you can create an event group Audio, add local static variable MusicVolume there. This variable will only be accessible inside the Audio group (which is good, because you don't need it anywhere else) and it will not be reset even if you reset all global variables.

    Thank you very much dop2000 that was very helpful

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