How do I use an expression to call a global variable?

Get help using Construct 2

Post » Fri May 15, 2015 3:40 pm

For example:

I have 10 global variables called global1, global2, global3 etc...

I have 10 buttons with instance variable: whatnumber

If I press button 1, can I say:

if button is pressed, add 1 to the global variable [ global & whatnumber ]

Does that make sense? Thanks for the help
B
6
S
1
Posts: 50
Reputation: 500

Post » Fri May 15, 2015 3:57 pm

Not currently with global variables, but you can use the dictionary object instead and do it.

if button 1 pressed, set key("global")&button instance variable to value of key( "global")&button instance variable +1

or whatever the expressions are.
B
43
S
23
G
20
Posts: 735
Reputation: 12,027

Post » Fri May 15, 2015 4:00 pm

Ah ok cool, thanks I'll try that now...
B
6
S
1
Posts: 50
Reputation: 500


Return to How do I....?

Who is online

Users browsing this forum: lukewasthefish and 15 guests