Stop background sprite animation

O

Occupant

Guest
I read this post, which seems very closely related to my issue:

https://forum.yoyogames.com/index.php?threads/sprite-animation-just-1-time-and-not-a-loop.8996/

In short, I want to stop the animation of the sprite assigned to my room background before it loops. The solution above talks about putting some image_speed = 0 code into the AnimationEnd event, but in GMS2, I don't see a way to interact with the animation events of the background sprite.

Is there another way to do this? I'd rather not create an instance layer object that displays the animated background sprite, because that will have side effects in my camera code.

Thanks for any help!
 

rIKmAN

Member
I read this post, which seems very closely related to my issue:

https://forum.yoyogames.com/index.php?threads/sprite-animation-just-1-time-and-not-a-loop.8996/

In short, I want to stop the animation of the sprite assigned to my room background before it loops. The solution above talks about putting some image_speed = 0 code into the AnimationEnd event, but in GMS2, I don't see a way to interact with the animation events of the background sprite.

Is there another way to do this? I'd rather not create an instance layer object that displays the animated background sprite, because that will have side effects in my camera code.

Thanks for any help!
You can use layer_background_speed() to set the speed of an animated background.
Read that page and do the maths for your particular background sprite (how many frames it will take to loop depending on the speed settings etc) and then stop it as required.
 
Top