How do I use local variables ?

0 favourites
  • 2 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Hi folks, here I am again because Construct 2 is doing paranormal soviet stuff with my variables. Here are very basic and simple events :

    This doesn't work. My local variable is never updated to 1 whenever I click. Exact same events are perfectly fine if I use a global variable. But a local variable inside the group ? No no the magical ghost inside my computer doesn't agree with that.

    Seriously, I don't see what I'm doing wrong, and according to Construct 2 documentations and tutorials, local variables scope are ok if inside groups, which is my case. Anyone to point out my mistake ?

    Many thanks folks

  • Try Construct 3

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

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

    By default, local variables reset to their initial value whenever entering their scope (usually every tick), like local variables in programming languages. If the variable is marked static in the Event Variable dialog it will persist its value permanently, like a global variable.

    Make it static and it will preserve its value like you want it to.

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