Events one after another do not work

  • I suppose I do not understand something, that's why I am asking for a hint.

    In the Construct documentation I found information that events are triggered from top to bottom.

    The code in the picture at a glance:

    1. The probe gets speed and turns left.

    2. When the probe does not find a corridor and room, than probe is to set itself to the player's position (this is the starting position).

    3. The probe receives the forward direction in which it moves further.

    The effect I get is that I see the probe go only forward. I do not see the movement to the left.

    It looks like the code was executed at the same time, not sequentially.

    Do I need to add something to the code to make it work the way I expect it to?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I do not understand the rules of performing events, but I did something like that and it works properly:

    - I added a variable which stores the value 0 - 3 (each digit defines the direction)

    - I check which number is in the variable and start testing particular direction

    - at the end of the test I change the value of the variable, thanks to which the next direction is started

  • I believe it's because you have go forward as a sub event of go left. As a result, it will at first go left for a fraction of a second and then, go forward.

    It makes no sense to have a trigger once as a sub event of a trigger once since the go left trigger once will prevent anything under it from triggering... more than once anyway

    Nextly, you don't have a condition that decides whether it triggers once. In your reply you had a condition 0-3. In the code above, even if you moved that sub event, both would fire when the code is run because there's no reason for them not to.

  • Thanks for helpful suggestions!

    The new code works because for every digit from 0 to 3 I give only one direction to check. Then I change the number in the global variable and test the next direction.

  • Exactly!

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