Jump to content

Image child of Image dies on destroy().


XekeDeath
 Share

Recommended Posts

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

 Share

  • Recently Browsing   0 members

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