titmael Posted June 16, 2014 Share Posted June 16, 2014 Hi, I've got a strange problem, the code goes through the if but the condition is false, I'm using Phaser 2.0.5 : It happens when I try to destroy a sprite after an animation is complete, here is the code :function Explosion(game, x, y){ this.game = game; Phaser.Sprite.call(this, this.game, x, y, 'explode'); this.anchor.setTo(.5, 1); this.explosionAnim = this.animations.add('boum', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 10, false); this.explosionAnim.onComplete.add(this.destroyExplosion, this); this.explosionAnim.play();}Explosion.prototype = Object.create(Phaser.Sprite.prototype);Explosion.prototype.constructor = Explosion;Explosion.prototype.destroyExplosion = function(){ this.destroy();}I really don't get why I have this behavior ... any help would be nice, I can't live with this Link to comment Share on other sites More sharing options...
titmael Posted June 16, 2014 Author Share Posted June 16, 2014 Just got my way with this : http://www.html5gamedevs.com/topic/5675-spritedestroy-throwing-thiscurrentanim-is-null/ But I think it's still a problem Link to comment Share on other sites More sharing options...
Recommended Posts