Prevent Execution of multiple IF statements

Get help using Construct 2

Post » Thu Jul 19, 2012 3:22 pm

It's been a while since I have made some games with C2, and I can't remember how to fix this:

I got a button event.

If Red -> set Blue

If blue -> set Green

The problem is now that It first executes If Red-> set blue
and then goes on to set Green because it is next in the code..

How to prevent that?
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Thu Jul 19, 2012 3:24 pm

Well, you could use a local variable. When one of IF statements is met, flip the variable on and test against it in all of those IF statements.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Thu Jul 19, 2012 4:09 pm

Use the System->Else condition

If Red -> set Blue
Else
If blue -> set Green
Vote for all the Construct 2 games on Steam Greenlight - Find them here
B
27
S
7
G
4
Posts: 313
Reputation: 4,926

Post » Thu Jul 19, 2012 4:43 pm

Easier solution wins!

Thx u 2
B
40
S
11
G
4
Posts: 665
Reputation: 8,403


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 15 guests