What's wrong?

Get help using Construct 2

Post » Tue May 26, 2015 9:31 pm

Can someone please inspect this screenshot and tell me what's wrong? It won't switch positions. I want it to be like, when I press one time, it changes to the opposite side, and then when I press again, it goes back.

Image
Website Twitter Indie Developer
B
20
S
6
G
4
Posts: 206
Reputation: 2,954

Post » Tue May 26, 2015 9:39 pm

try..
Image
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Wed May 27, 2015 9:30 am

that did it, thanks!
Website Twitter Indie Developer
B
20
S
6
G
4
Posts: 206
Reputation: 2,954

Post » Wed May 27, 2015 11:15 am

To answer the title question, what is wrong :
Events are read from top to bottom.

In your first example, X=75 is true, so the object is moved. And this only happens once.
Then it moves to the next event, x=564. And this event, now, is also true since the very previous event just moved the object to that position. So the object is moved again (actions are still executed).

So actually, the object got double switched in the same tick. Instead of not working, it worked too good compared to what you were expecting.

In korbaach example, the Else condition will make it so that if and only if event 2 hasn't been executed, then event 3 will be executed if its conditions are true.
Let's take back the previous execution :
Touch is made,
Event 2 - Object X = 75, event is true, the sprite is moved.
Event 3 - "Else" (only true if the previous event hasn't been executed) FALSE, so this current event won't be executed

A new touch
Event 2 - FALSE (sprite X is currently 564), event not executed
Event 3 - Else (true, previous event wasn't executed), X=564 ? True so sprite is moved back to X = 75

This is how C2 "thinks" and reads the event sheet.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
296
S
119
G
96
Posts: 7,332
Reputation: 71,306

Post » Wed May 27, 2015 4:37 pm

Thanks, mate! Well explained :)
Website Twitter Indie Developer
B
20
S
6
G
4
Posts: 206
Reputation: 2,954


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 6 guests