local variable doesn't change

Get help using Construct 2

Post » Sat Nov 23, 2013 3:57 pm

I don't understand this:

This is my situation:



Group
local variable Switch = 0 (initial value, not constant or static.)

If clicked on mouse, set value Switch to 1.



But when I check the variable, it stays at value 0.
Why is that?[
B
28
S
6
G
7
Posts: 678
Reputation: 5,676

Post » Sat Nov 23, 2013 4:02 pm

Local variables always start with their default value when the event runs.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788

Post » Sat Nov 23, 2013 4:49 pm

Local variables are reset when c2 starts going through the event sheet again. If you want it to stay throughout the entire game you need to set it to static.
B
47
S
14
G
7
Posts: 603
Reputation: 8,141

Post » Sun Nov 24, 2013 11:09 pm

Thank you, cow that is encrypted.
That was exactly what I was looking for.
B
28
S
6
G
7
Posts: 678
Reputation: 5,676


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, ST314, tarek2 and 31 guests