Local Var weirdness

Get help using Construct 2

Post » Sun Nov 11, 2012 10:50 am

My local variable seems to be being reset for some reason.
Any ideas?
capx
B
7
S
1
Posts: 74
Reputation: 1,232

Post » Sun Nov 11, 2012 11:14 am

It's correct and expected behaviour that a local variable will reset to it's initial value each tick. If you need the value to persist you probably want to make the variable static. See the manual entry for variables.

Alternatively, you could make the variable a global, but that's not something you should do unless your design really calls for it.
B
24
S
5
G
2
Posts: 104
Reputation: 3,136

Post » Sun Nov 11, 2012 11:24 am

Ah, thanks!
I just assumed that local vars were scoped at the group level. Changed it to static, an easy fix. mutuware2012-11-11 11:24:16
B
7
S
1
Posts: 74
Reputation: 1,232


Return to How do I....?

Who is online

Users browsing this forum: amarcelo, anty21ro, Magistross and 20 guests