Jump to content

Destroy an animation instance


fitness23
 Share

Recommended Posts

I have a function that keeps repeating once every 5 seconds. In that function I have an animation that has some actions assigned in the oncomplete area. However I need to cancel this animation once it's complete so that the actions inside the oncomplete don't get assigned twice. Can I do something like this:

var robotAttackAnim = enemy.animations.play('robotAttack');
				robotAttackAnim.onComplete.add(function() {


robotAttackAnim.destroy();

}, this);

Please note I wish to keep using the animation frames "robotAttack" again, it's just I don't want to use the instance of "robotAttackAnim" as it'll be re-assigned the next time the function is called.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...