Stop the sprite on last frame

1.3k Views Asked by At

So I have this serious problem and I don't know how to let it work. I have this in my step event:

if (image_index >= 6 && image_index <= 8) && (sprite_index == spr_sonia_down_right) {
    image_speed = 0;
    image_index = 7;
}

The thing that I want is that on the last frame the sprite stops. I have an object and in that object I put the sprites or I change them using sprite_index and that works, but my sprite "down" has a secuence that she is going down and down and down. When she is complete down, that is in the 8 sub image, I want to freeze the sprite on that frame, but I can't reach that.

1

There are 1 best solutions below

0
On

I think there are two things that you can do to improve this:

  • Instead of guessing through (image_index >= 6 && image_index <= 8), you can also use the Animation End Event. This Event happens when the object's current sprite has finished it's animation.
  • I would've made a seperate single sprite that shows the last sprite of the animation, (for example spr_sonia_down_end_right) and show that sprite once the animation is done.

So, for example in Animation End:
if (sprite_index == spr_sonia_down_right) {
    sprite_index = spr_sonia_down_end_right;
}