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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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