Spine Animation Play ONCE

O

Ota

Guest
This should be simple I guess. I just need to play a spine animation, when it ends I want to do anything else. Like this:

play animation (shoot);
when animation shoot ends, or sprite index is 12, or godamn spine frame is 12, end IT,END IT END IT, FOR CHRIST SAKE END THIS! and go back to this other stupid state I did.

I tried this:

if(sprite_index == skeleton_animation_get_frames("shoot"))

And I even draw the sprite_index on screen to find it is stuck on 0, don't know why. It was working before...

For MAMA POODLES' SAKE, I, me, I don't want to send a rocket to MARS! I wanna let the animation die on her own. Why that gotta be so darn difficult?
 
E

EbonHeart

Guest
The sprite_index returns the sprite being used, all frames included. What you want is image_index.
 
  • Like
Reactions: Ota
O

Ota

Guest
The sprite_index returns the sprite being used, all frames included. What you want is image_index.
Oh, I see! Thanks!
But I guess my logic is still broken. if(image_index == skeleton_animation_get_frames("shoot")) or even if(image_index >= 12)) won't seem to work.
 
O

Ota

Guest
FIXED IT!
I'm posting it here so people can benefit from it. Let me know if there are better ways:

if (skeleton_animation_get() == "idle")
{
skeleton_animation_set("shoot");

} if(image_index >= 11.50) // my number of frames is 12 you can get frames by skeleton_animation_get_frames() and draw them with draw_text to know or just look in spine.

{
ms = mecha_states.idle;
}

for some reason it does not work with 12, which is the last frame... But well. DIDN'T IT GO DOWN?! BOOYA!!
 
O

Ota

Guest
This might not be a better way to do it depending on how you prefer to organize your code but you could use the Animation End event to check if the animation played through completely. This works even if the animation speed is greater than or less than 1.
ah, now I get it! This is really usefull, I think it is a better way, just gotta find a way to fit it into a finite state machine. Thanks!
 
Top