mirror of
https://github.com/wassname/phaser.git
synced 2026-07-21 12:40:56 +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.
|
||||
*
|
||||
|
||||
@@ -197,12 +197,20 @@ Phaser.TilemapLayer.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
this._prevX = this._dx;
|
||||
this._prevY = this._dy;
|
||||
|
||||
this._dx = -(this._x - (this._startX * this.tileWidth));
|
||||
this._dy = -(this._y - (this._startY * this.tileHeight));
|
||||
|
||||
this._tx = this._dx;
|
||||
this._ty = this._dy;
|
||||
|
||||
// First let's just copy over the whole canvas, offset by the scroll difference
|
||||
|
||||
// Then we only need fill in the missing strip/s (could be top/bottom/left/right I guess)
|
||||
// ScrollZone code might be useful here.
|
||||
|
||||
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
||||
|
||||
for (var y = this._startY; y < this._startY + this._maxY; y++)
|
||||
@@ -260,11 +268,11 @@ Phaser.TilemapLayer.prototype.deltaAbsY = function () {
|
||||
}
|
||||
|
||||
Phaser.TilemapLayer.prototype.deltaX = function () {
|
||||
return this._x - this._prevX;
|
||||
return this._dx - this._prevX;
|
||||
}
|
||||
|
||||
Phaser.TilemapLayer.prototype.deltaY = function () {
|
||||
return this._y - this._prevY;
|
||||
return this._dy - this._prevY;
|
||||
}
|
||||
|
||||
Object.defineProperty(Phaser.TilemapLayer.prototype, "x", {
|
||||
|
||||
Reference in New Issue
Block a user