How to play one animation after another?

Howdy! How can I make an animation to stop when it’s done? I want to make the animation attack, when it’s done, play the idle animation

if self.isAttacking then
	self.isAttacking = false
        msg.post("#sprite", "play_animation", { id = hash("attack") })		
end

Source of my code:

I think you get more control when using the sprite.play_flipbook function instead of posting a message.

1 Like

Look into the animation_done message. Use play_animation, make sure your animation only plays once instead of looping, and play the new animation on animation_done.

1 Like