XekeDeath Posted February 28, 2014 Share Posted February 28, 2014 I have a class that is subclassing Phaser.Image, and I am adding a child to it directly with the addChild function in the constructor:Agent = function(game, map, x, y){ Phaser.Image.call(this, game, x, y, 'agents', 0); // Other init code... //Speech bubbles... this.speech = new Phaser.Image(this.game, -6, -12, "speech", "hi"); this.addChild(this.speech);};On occasion, these Agents will die, and are destroy()ed.This worked yesterday, but today it throws an error in the Image.destroy() function of the child sprite (this.speech object).I looked in the commits (because Rich told me to stop being lazy ) and saw the destroyChild changes, so I assume that yesterday the speech image was not being destroyed, and today it is, and therefore causing issues.Image.js Line 377: if (this.parent) { this.parent.remove(this); //<< Here dies, because the Image class does not have a remove function. } Link to comment Share on other sites More sharing options...
rich Posted February 28, 2014 Share Posted February 28, 2014 Ah bollocks, yes of course. I've updated all the classes now so they check if they should use remove or removeChild. Sorry Link to comment Share on other sites More sharing options...
Recommended Posts