How do I Compare Vars in an Action

Get help using Construct 2

Post » Thu Mar 27, 2014 1:22 pm

Hi guys.

I have this Event
Image

I have two Global Variables:LEVEL,HIGHSCORE

how i can make that comparison as an ACTION?

When i try to set an Action i cant see the "Compare Variable" option...as you can see in the pic, i can do it but in a Event level...
B
13
S
2
G
1
Posts: 28
Reputation: 960

Post » Thu Mar 27, 2014 2:45 pm

I think you can use the operators:

=, <>, <, <=, >, >=, & (and), | (or) in expressions, for exemple:

Set local key: "SavedSkore" to (LEVEL > HIGHSCORE ? HIGHSCORE : "0").

Will set the local key "SavedSkore" to HIGHSCORE if LEVEL is superior to HIGHSCORE, else, it will set it to 0 (it is just an exemple)

you could also use a function, have the comparison done inside the function, and return a different value depending on the value ( function.Call() will execute a function, and return it's return value)
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
52
S
22
G
18
Posts: 2,122
Reputation: 17,093


Return to How do I....?

Who is online

Users browsing this forum: el3um4s and 9 guests