Jump to content

Sprite.Destroy() throwing "this.currentAnim is null"


ZoomBox
 Share

Recommended Posts

Hello !

 

I have a quite simple problem (Phaser 2.0.2).

On a custom Sprite with an animation, I call sprite.Destroy() when the animation is complete but then it throws me "TypeError: this.currentAnim is null" (line 37562).

 

Here's my code:

SpecialFX = function(_x, _y, _spriteName) {    Phaser.Sprite.call(this, game, _x, _y, _spriteName);    this.animIdle = this.animations.add('idle', [0, 1, 2, 3, 4], 10, false);    this.animIdle.onComplete.add(this.animationStopped, this);    this.animations.play('idle');    game.add.existing(this);};SpecialFX.prototype = Object.create(Phaser.Sprite.prototype);SpecialFX.prototype.constructor = SpecialFX;SpecialFX.prototype.animationStopped = function() {    this.destroy();};

It looks like the AnimationManager attached to my sprite is not destroyed and still try to update.

 

Thank you in advance.

Link to comment
Share on other sites

  • 2 months later...

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...