Issue with timer switch

Get help using Construct 2

Post » Wed Feb 15, 2012 12:59 pm

Here's the code: http://i.imgur.com/gSbUh.png

It should hide and show the two background alternatively every two seconds, while in reality it just do the one with the = 2 condition (which is strange since it starts at 1).

Any help is greatly appreciated.
B
29
S
9
G
6
Posts: 525
Reputation: 8,294

Post » Wed Feb 15, 2012 1:20 pm

if you read it,
if background = 0 set background to 1
and then event 3 is true and it goes back to 0
So both event happens.

Also local variable are reset to there default value every time you read the subevent part they are into.

Your solution is to use a global variable, not a local. Just drag the declaration just before event 1.
And then event 1 before your subevents just do a
System: set background to 1-background

It will toggle between 0 and 1Yann2012-02-15 13:21:43
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Wed Feb 15, 2012 5:06 pm

Thank you!
B
29
S
9
G
6
Posts: 525
Reputation: 8,294


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 17 guests