Jump to content

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


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

  • Recently Browsing   0 members

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