• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM [SOLVED] Can you reverse an animation?

Yal

šŸ§ *penguin noises*
GMC Elder
Indeed, a negative image_speed will play the animation backwards. (The last frame of the sprite's animation is image_number - 1, since it's zero-indexed). Be aware that the Animation End event is a bit weird when you use a negative image_speed, so you might wanna avoid using that for logic when playing reversed animations. Also, -1 used to have a special meaning for animation speeds, not sure if it's just an ordinary number now.
 

Dr_Nomz

Member
Well I'm using GMS1.4 so it shouldn't matter.

Yeah I figured that, but I just wanted to check if there were any other ways or if that was the go to one. Thanks!

Although now that you mention it, is there a way to see if the object is at the BEGINNING of it's animation? Like the opposite of animation_end?
 
J

J_Dev

Guest
Well I'm using GMS1.4 so it shouldn't matter.

Yeah I figured that, but I just wanted to check if there were any other ways or if that was the go to one. Thanks!

Although now that you mention it, is there a way to see if the object is at the BEGINNING of it's animation? Like the opposite of animation_end?
You could say if (floor(image_index) == 0)
 
N

NeZvers

Guest
That is if you want to stop animation on the first game frame in enters 0 sprite frame, meaning you don't keep it whole time it was supposed to play.
So maybe something like this would counter that problem and keep image to on and gives signal that next frame need to be different.
Code:
if(image_index + image_speed < 0){
//code
}

//or

if(image_index  <= abs(image_speed))
{
//code
}
 
Top