Why won't it play the death animation, but it will delete the player?

My code works and deletes the player when he has lost enough life points. But when I try to inset a “change animation” the player will simply stop all animations. It won’t change animations even if I get rid of the “delete object” action. I’m so confused because all the other “change animations” I’ve done work, but this one time it won’t work at all. I can only post 1 photo so I’ll post a pic of the code that doesn’t work. For some reason “changing animation” causes it to not work.


Hi, I know this isn’t exactly what you’re wanting to know, but I recommend - if you plan to add a large amount of objects in the future - to use one object sprite for the heart with variable ID’s assigned to instances of that same object.

You can still control whether they are visible or not based on the health bar variable, set unique positions, delete the object without affecting other the instances, and add any other events you want in association with the ID. Just occurred to me that this method may be easier to manage in the long run if your object list starts getting ‘heavy’.

As for your particular issue…is there any other code running that may conflict? Particularly in relation to other animations set up elsewhere? If so, you may wish to include an action to “pause the current animation” when the PlayerHealthBar = 0 and then set the one you want by name where you currently have it by number.

your sub-event delete your sprite object with its animations immediately.

I tried that and it doesn’t work. I have no idea what’s going on. I can’t even get it to change the animation at all.

Upload your folder proyecto to mediafire and users can help you better :wink:

Is there any other place where you “do = 0 to the variable of PlayerHealthBar” as an action the way you do = 1 at the beginning of the scene in your image?

1 Like

try to pull out the subevent in the main column, and give it a “screen variable PlayerHealthBar is =0” condition too. I’m not sure, but the pathfinder’s “reached destination” condination isn’t work as a subevent. may be this is the same case. and I think, you doesn’t need to pause an animation before change it.

When you set an animation, you need to make sure it’s only triggered once, or your animation keeps getting reset.

Thanks, that finally worked. It was driving me crazy to solve this problem. And thanks to everyone else for helping out.

1 Like