Local variables

Get help using Construct 2

Post » Sun May 06, 2012 5:48 pm

um whats the deal with local variables and how do you use them?
I cant even seem to reference them like you can global variables, ie if _variable = num etc etc
I can only set them and set a variable to their number, i cant check if they are something, is it possible to target them in and if statement?
B
9
S
4
G
3
Posts: 223
Reputation: 3,433

Post » Sun May 06, 2012 5:55 pm

Local variables are global variables that are only active under groups or sub-events, and can only be referenced inside that group or sub-event.

Read about variables here.
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Mon May 07, 2012 2:35 am

I was trying to figure this out, too, and created a small test capx to put the value of a local variable in a group into a global variable, which can then be used anywhere in the events. Here is the capx as an example.

http://dl.dropbox.com/u/6109058/localvsglobal.capx
B
16
S
4
G
1
Posts: 40
Reputation: 2,705

Post » Mon May 07, 2012 2:54 pm

Local variables were also briefly discussed in our latest blog post.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,518


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go and 5 guests