mirror of
https://github.com/wassname/phaser.git
synced 2026-07-09 00:20:17 +08:00
Sprite.destroy is back in business.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user