How do I make an action happen after the a for loop COMPLETELY finished?

0 favourites
  • 5 posts
From the Asset Store
SynthWave Loop Pack includes 68 seamless loops, founded on 11 original melodies.
  • Hi!

    So I have a group of diggers (instances of a sprite).

    I want them to move to a point, and only after ALL of them are at that point, destroy them.

    I can't figure out where to put the destroy action so that it won't destroy them before they moved or destroy each one as he reaches said point.... Like I said, I want all of them to reach the point first, then destroy them all.

    Thanks a lot! :)

    (in the example in this pic, diggers are destroyed one after the other as they reach the point)

  • Hi!

    Maybe you can transform the for each to a for loop (from 0 to object.count-1), and test on a subevent if the index is equal to OBJECT.count -1 ?

    something like that

    Hope it helps !

  • Thanks for the idea!

    I forgot to mention that this loop is already inside another loop... how do I distinguish loopIndex of one loop from the other?

    (If I do it like in the pic below, they get destroyed before actually moving)

  • If all diggers are moving simultaneously and arrive at the same time (after 2 seconds), and if there are no "Waits" inside the loop, you can simply do this:

    If diggers finish moving at different time, you need to use "On tween finished" trigger. With multiple instances it's a bit tricky:

  • 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:)

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