Sprite.destroy is back in business.

This commit is contained in:
photonstorm
2013-10-13 01:29:57 +01:00
parent 574f4f351b
commit e98aa205ea
5 changed files with 72 additions and 5 deletions
+32
View File
@@ -34,4 +34,36 @@ Phaser.Events = function (sprite) {
this.onAnimationComplete = null;
this.onAnimationLoop = null;
};
Phaser.Events.prototype = {
destroy: function () {
this.parent = null;
this.onAddedToGroup.dispose();
this.onRemovedFromGroup.dispose();
this.onKilled.dispose();
this.onRevived.dispose();
this.onOutOfBounds.dispose();
if (this.onInputOver)
{
this.onInputOver.dispose();
this.onInputOut.dispose();
this.onInputDown.dispose();
this.onInputUp.dispose();
this.onDragStart.dispose();
this.onDragStop.dispose();
}
if (this.onAnimationStart)
{
this.onAnimationStart.dispose();
this.onAnimationComplete.dispose();
this.onAnimationLoop.dispose();
}
}
};
+24
View File
@@ -580,6 +580,30 @@ Phaser.Sprite.prototype.kill = function() {
}
/**
* Description.
*
* @method Phaser.Sprite.prototype.destroy
*/
Phaser.Sprite.prototype.destroy = function() {
if (this.group)
{
this.group.remove(this);
}
this.input.destroy();
this.events.destroy();
this.animations.destroy();
this.alive = false;
this.exists = false;
this.visible = false;
this.game = null;
}
/**
* Description.
*