From 2b99cb4be4fb9092bda80434027551b6c905809e Mon Sep 17 00:00:00 2001 From: "Josh Shepard (jcs)" Date: Sat, 30 Nov 2013 17:40:24 -0800 Subject: [PATCH] =?UTF-8?q?move=20TilemapLayer=20positioning/rendering=20t?= =?UTF-8?q?o=20postUpdate=20to=20be=20in=20line=20with=20=E2=80=98normal?= =?UTF-8?q?=E2=80=99=20Sprites.=20reverts=20e91d40b9fcee53c453f8d94253b6fe?= =?UTF-8?q?a8014a1087=20-=20fix=20was=20incorrect=20&=20regressed=20fixedT?= =?UTF-8?q?oCamera=20Sprites=E2=80=99=20&=20TilemapLayer=20positioning.=20?= =?UTF-8?q?Fixes=20#237?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/World.js | 4 ++-- src/tilemap/TilemapLayer.js | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/core/World.js b/src/core/World.js index 61114e23..9ecd1cd9 100644 --- a/src/core/World.js +++ b/src/core/World.js @@ -113,6 +113,8 @@ Phaser.World.prototype.update = function () { */ Phaser.World.prototype.postUpdate = function () { + this.camera.update(); + if (this.game.stage._stage.first._iNext) { var currentNode = this.game.stage._stage.first._iNext; @@ -128,8 +130,6 @@ Phaser.World.prototype.postUpdate = function () { } while (currentNode != this.game.stage._stage.last._iNext) } - - this.camera.update(); } /** diff --git a/src/tilemap/TilemapLayer.js b/src/tilemap/TilemapLayer.js index 5099bcd9..5efcaceb 100644 --- a/src/tilemap/TilemapLayer.js +++ b/src/tilemap/TilemapLayer.js @@ -279,13 +279,15 @@ Phaser.TilemapLayer.prototype = Phaser.Utils.extend(true, Phaser.TilemapLayer.pr Phaser.TilemapLayer.prototype.constructor = Phaser.TilemapLayer; /** -* Automatically called by World.preUpdate. Handles cache updates. +* Automatically called by World.postUpdate. Handles cache updates. * -* @method Phaser.TilemapLayer#update +* @method Phaser.TilemapLayer#postUpdate * @memberof Phaser.TilemapLayer */ -Phaser.TilemapLayer.prototype.update = function () { +Phaser.TilemapLayer.prototype.postUpdate = function () { + Phaser.Sprite.prototype.postUpdate.call( this ); + this.scrollX = this.game.camera.x * this.scrollFactorX; this.scrollY = this.game.camera.y * this.scrollFactorY;