Author Topic: How can I make a sprite's animation not loop (only play once and then stop)?  (Read 1601 times)

PlasmaKaboom

  • Wannabe
  • Posts: 15
  • OS:
  • Unknown Unknown
  • Browser:
  • Chrome 57.0.2987.146 Chrome 57.0.2987.146
    • View Profile
  • Playstyle: Keyboard
Is there an easy way to tell an object not to loop it's sprite animation? When I restart a room I want an animation of one of my sprites to only play once and then stop, only repeating when I restart the room again.

WetWookie

  • Cherry Eater
  • Posts: 90
  • OS:
  • Windows 10 Windows 10
  • Browser:
  • Firefox 52.0 Firefox 52.0
    • View Profile
  • Playstyle: Keyboard
There's an animation end event. I think you can just set the image_speed to 0 in it.

PlasmaKaboom

  • Wannabe
  • Posts: 15
  • OS:
  • Unknown Unknown
  • Browser:
  • Chrome 57.0.2987.146 Chrome 57.0.2987.146
    • View Profile
  • Playstyle: Keyboard
I should have been more specific. The suggestion I was just given does make the sprite animation play just once, however it disappears once it's done. I need it to pause after it plays once (meaning I need it to freeze in place on the sprites last animation frame). Is there a way to do that?

Denferok

  • Community Manager
  • The Kid
  • Administrator
  • Posts: 355
  • OS:
  • Windows 10 Windows 10
  • Browser:
  • Chrome 57.0.2987.133 Chrome 57.0.2987.133
    • View Profile
    • My stream
  • Playstyle: Keyboard
Put this into the animation end event and it should work
image_index = the last image number of your sprite's animation
image_speed = 0

PlasmaKaboom

  • Wannabe
  • Posts: 15
  • OS:
  • Unknown Unknown
  • Browser:
  • Chrome 57.0.2987.146 Chrome 57.0.2987.146
    • View Profile
  • Playstyle: Keyboard
Oh my gosh thank you! That's exactly what I was looking for!