[Solved] How to play a sprite animation only once?


#1

Hello, I am building a space shooter for Android and am wondering how I can get the “Upgrade” animation I made to play only once when the ship is upgraded.

Here’s how I have things setup:
Variable “shipUpgrade” = 0
collision with sprite “shipUpgrade_spr” adds 10 to “shipUpgrade”
if “shipUpgrade” = 10, change “Player” to animation “1”

Basically a hidden variable that goes up by 10 every time you run into the upgrade object. Upgrades are set at different intervals, so the first is 10, then the next is at 30, then 60, etc. So the more you upgrade the more item pickups it takes to get the next ship level.

I am trying to put the “upgrade” animation to play when the ship is upgraded, but I have no idea how to stop it from playing continuously.

Any help is appreciated, thank you very much!


#2

Of course, after searching for an hour and deciding to make a post. I figure it out.

Going to leave this up in case others have similar problems.

Solution:
Add “Trigger once while true” to the conditions of your action. Problem solved.