How do I loop a set of actions?

0 favourites
  • 6 posts
From the Asset Store
Alot of High Quality Items sound effects for your game!
  • hi!

    I have an sprite that must make this things over and over when created:

    wait a second, rotate 180°, wait again, flip

    and then repeat from the begining until the end of the world.

    So, I have all those actions programed one under the other and lack one last action that says "start again from the begining".

    how do i do that?

  • You can organize your events differently, that's probably the easiest.

    Create you objects (In there own event)

    Give them a variable called (INT Flip_Rotate = 0)

    (Not sure when you say flip if you mean rotate 180 degree again or flip, but anyway should work regardless, so if I misunderstood you can probably fix It easy)

    Every 1 second

    For each Object

    If Flip_Rotate = 0

    Rotate 180

    Set Flip_Rotate = 1


    Object Flip

    Set Flip_rotate = 0

    If you want them to do it individual so it depends on when they spawned, you should attach a Timer behaviour to the objects instead of using every 1 sec.

  • well, i just tried this. the simpler way I found is to program the whole set of actions with the condition being "every 1 second". each event takes places between a wait of 0.25 second, and it's 4 events, so the total gives 1 second. So every second the set repeats giving the illusion that it loops.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I would do it with a set of timers. Take your first action, and let it be triggered by the start of the layout OR the last timer. At the end of the first action set your first timer. Take your second action, and let it be triggered by the first timer. As part of the second action, set a timer to trigger the third action. As part of the third action, you can set a timer that triggers the first action. You can right click on an event to Make it into an OR block.

  • It's just that I still don't know how to use timers or what they are for. that's why I went the other way.

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