Legacy GM Check for the end of an animation?

Hello, I would like the gun object in my game to play an animation when it shoots by switching sprite, and then at the end of the animation it switches back to the regular sprite, but I can't get it to work...
Code:
if(image_index >= image_number){///Reset animation
    sprite_index = spr_gun;
}
I for some reason can't find an answer to this that isn't for GMS2.
 

Simon Gust

Member
Image index might not hit exactly image number and it definetly wont go beyond image number. Try checking for the image number decreased by the image speed.
Code:
if (image_index >= image_number - image_speed)
 
Top