mirror of
https://github.com/wassname/phaser.git
synced 2026-07-09 00:20:17 +08:00
Display Objects now clean-up their children properly on destroy.
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
* events (via Sprite.events), animation (via Sprite.animations), camera culling and more. Please see the Examples for use cases.
|
||||
*
|
||||
* @constructor
|
||||
* @extends PIXI.Sprite
|
||||
* @param {Phaser.Game} game - A reference to the currently running game.
|
||||
* @param {number} x - The x coordinate (in world space) to position the Sprite at.
|
||||
* @param {number} y - The y coordinate (in world space) to position the Sprite at.
|
||||
@@ -516,6 +517,13 @@ Phaser.Sprite.prototype.destroy = function() {
|
||||
this.events.destroy();
|
||||
}
|
||||
|
||||
var i = this.children.length;
|
||||
|
||||
while (i--)
|
||||
{
|
||||
this.removeChild(this.children[i]);
|
||||
}
|
||||
|
||||
this.alive = false;
|
||||
this.exists = false;
|
||||
this.visible = false;
|
||||
|
||||
Reference in New Issue
Block a user