How to check if specific animation is active and running?

how to check onUpdate if sceneobject has specific animation running at the moment or not?

And is there any possibility to run animation ( example onKeyDown: this.playAnimation("swingSword")) only one time,
and after that animation ends, change to another animation automatically active?


All 2 Comments

Hi Janne

To check if a specific animation is playing, you could do something like this

if (_.myObject.getSprite().getCurrentAnimationName() == 'myAnimation')
    // do something here

If you want to play a specific animation after another one finishes, for example you want to play a 'dance' animation once your 'swingSword' animation is over, you can do this:


_.myObject.onAnimationEnd = function()
    this.onAnimationEnd = null;



That works! Thank you :)

Post a reply
Add Attachment
Submit Reply
Login to Reply