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:
Richard Davey
2013-09-23 03:26:08 +01:00
parent bc02a1a05e
commit 257cbe3be8
12 changed files with 517 additions and 360 deletions
+8 -7
View File
@@ -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;
}
}
}