[Solved] Trigger 2 animation loops upon collision, repeatable each collision

How do I trigger 2 animation loops upon collision, and have it be repeatable each collision after that?

I managed to get it to play the animation on collision, but it either keeps looping after that, or if I don’t have the loop checked in the sprite animation, it just plays once. It doesn’t trigger again when it collides again.

I’d like it to loop 2 (or 3) times. I could just build that into the animation and set it not to loop, but either way, I can’t seem to get it to trigger when they collide again after that.

You can do it a few ways.

  1. The easiest is to uncheck the loop option in the animation, and repeat the frames in the animation definition. So you’ll end up the frame sequence repeated 2 or 3 times within the animation.

  2. Another is to uncheck the loop option in the animation and add object variable to keep track of how many times the animation has been run. Using the condition to check the animation has finished, decrease the object variable and replay the animation if the desired number of iterations hasn’t been met.

Can you provide a screen shot of the events?

1 Like

I looked at the “play animation” and it gives no options to alter the definition. How do I do that?

Do you mean for the first option I suggested? That’s in the object’s animation. Check all the frames you want to copy, then right click and select “Duplicate selection” :

1 Like

Oh, ok. I already new about that I thought you meant something else.

Any idea why it doesn’t replay the animation every collision weather or not I have “trigger once”?

The play animation is used after the animation is paused.

In your case, set the current frame to 0 instead. That will replay the animation from the start.

That did the trick! Thank you!