ZoomBox Posted April 15, 2014 Share Posted April 15, 2014 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 More sharing options...
ZoomBox Posted April 15, 2014 Author Share Posted April 15, 2014 I found a way for it not to bug:// I first delete animationsthis.animations = undefined;// Then I'm able to destroy my sprite (and the AnimationManager.update() of the sprite is not called again)this.destroy();So it looks more like a lack in the Sprite.destroy() function. titmael 1 Link to comment Share on other sites More sharing options...
titmael Posted June 16, 2014 Share Posted June 16, 2014 Still a problem in 2.0.5, just get my way with your solution Link to comment Share on other sites More sharing options...
Recommended Posts