mirror of
https://github.com/wassname/phaser.git
synced 2026-07-01 16:50:43 +08:00
Much more stable collision, just need to refactor the Tilemap handling - see if I can optimise it a bit too.
This commit is contained in:
@@ -210,9 +210,6 @@ Phaser.Sprite.prototype.preUpdate = function() {
|
||||
this._cache.dirty = true;
|
||||
}
|
||||
|
||||
// this._cache.x = this.x - (this.game.world.camera.x * this.scrollFactor.x);
|
||||
// this._cache.y = this.y - (this.game.world.camera.y * this.scrollFactor.y);
|
||||
|
||||
if (this.visible)
|
||||
{
|
||||
this.renderOrderID = this.game.world.currentRenderOrderID++;
|
||||
@@ -299,10 +296,14 @@ Phaser.Sprite.prototype.postUpdate = function() {
|
||||
// The sprite is positioned in this call, after taking into consideration motion updates and collision
|
||||
this.body.postUpdate();
|
||||
|
||||
this.position.x -= (this.game.world.camera.x * this.scrollFactor.x);
|
||||
this.position.y -= (this.game.world.camera.y * this.scrollFactor.y);
|
||||
this.x -= (this.game.world.camera.x * this.scrollFactor.x);
|
||||
this.y -= (this.game.world.camera.y * this.scrollFactor.y);
|
||||
this._cache.x = this.x - (this.game.world.camera.x * this.scrollFactor.x);
|
||||
this._cache.y = this.y - (this.game.world.camera.y * this.scrollFactor.y);
|
||||
|
||||
if (this.position.x != this._cache.x || this.position.y != this._cache.y)
|
||||
{
|
||||
this.position.x = this._cache.x;
|
||||
this.position.y = this._cache.y;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user