I’n my game when the player isn’t moving i’d like it to be in the idle animation but when moving be in the run animation. I achieved it through this code:
if self.velocity == 0 then play_animation(self, anim_idle) else play_animation(self, anim_run) end
But when the player hits an object i want it to go into the hurt animation, this is done in a different subroutine to the above code
But i found that eventhough it seems to be coded correctly the hurt animatin doesn’t run, i have changed the code so that the run animation code looks like this:
if self.velocity.x > 0 then play_animation(self, anim_run) end
this works fine as the player runs when moving and is hurt when collising with an object. But i was wondering if i could still impliment the idle animation after the hurt animation or if the player has stopped moving to make the game look smoother. Has this happened to anyone else?