1. Hey! Guest! The 35th GMC Jam will take place between November 28th, 12:00 UTC - December 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

Stop background sprite animation

Discussion in 'Programming' started by Occupant, Nov 10, 2019.

  1. Occupant

    Occupant Member

    Joined:
    Aug 14, 2019
    Posts:
    9
    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!
     
  2. rIKmAN

    rIKmAN Member

    Joined:
    Sep 6, 2016
    Posts:
    4,661
    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.
     
    Occupant likes this.
  3. Occupant

    Occupant Member

    Joined:
    Aug 14, 2019
    Posts:
    9
    Thanks! I will give this a shot now.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice