I tried playing an animation after the previous animation is finished using the animationcomplete
event. However that event seems to trigger on the animation inside the event itself as well, causing an endless loop.
How can I play two subsequent animations instead?
character.sprite.play("ball_out").on('animationcomplete', () => {
character.sprite.play("feather_in");
});
Apparently using
character.sprite.play("ball_out").once('animationcomplete', () => {
character.sprite.play("feather_in");
});
fixed the issue! (Note the once
in lieu of on
)