What's wrong?

0 favourites
  • 5 posts
From the Asset Store
Be quick and choose whether the shown equation is right or wrong.
  • 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.

  • try..

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • that did it, thanks!

  • 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.

  • Thanks, mate! Well explained

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)