From 18a07f7a88ebfded229dd845a1df35f44889dcfc Mon Sep 17 00:00:00 2001 From: Izzimach Date: Fri, 8 Nov 2013 11:40:07 -0700 Subject: [PATCH] Switched Tilemap to use user-specified layer. Tilemap was using the current layer even if a layer was specified as a parameter in getTile/setTile. Changed it to use the user layer if one is specified. --- src/tilemap/Tilemap.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/tilemap/Tilemap.js b/src/tilemap/Tilemap.js index 2a46fc8d4..e58d1f653 100644 --- a/src/tilemap/Tilemap.js +++ b/src/tilemap/Tilemap.js @@ -114,9 +114,9 @@ Phaser.Tilemap.prototype = { if (typeof layer === "undefined") { layer = this.currentLayer; } - if (x >= 0 && x < this.layers[this.currentLayer].width && y >= 0 && y < this.layers[this.currentLayer].height) + if (x >= 0 && x < this.layers[layer].width && y >= 0 && y < this.layers[layer].height) { - this.layers[this.currentLayer].data[y][x] = index; + this.layers[layer].data[y][x] = index; } this.dirty = true; @@ -127,9 +127,9 @@ Phaser.Tilemap.prototype = { if (typeof layer === "undefined") { layer = this.currentLayer; } - if (x >= 0 && x < this.layers[this.currentLayer].width && y >= 0 && y < this.layers[this.currentLayer].height) + if (x >= 0 && x < this.layers[layer].width && y >= 0 && y < this.layers[layer].height) { - return this.layers[this.currentLayer].data[y][x]; + return this.layers[layer].data[y][x]; } }, @@ -141,9 +141,9 @@ Phaser.Tilemap.prototype = { x = this.game.math.snapToFloor(x, tileWidth) / tileWidth; y = this.game.math.snapToFloor(y, tileHeight) / tileHeight; - if (x >= 0 && x < this.layers[this.currentLayer].width && y >= 0 && y < this.layers[this.currentLayer].height) + if (x >= 0 && x < this.layers[layer].width && y >= 0 && y < this.layers[layer].height) { - return this.layers[this.currentLayer].data[y][x]; + return this.layers[layer].data[y][x]; } }, @@ -160,9 +160,9 @@ Phaser.Tilemap.prototype = { x = this.game.math.snapToFloor(x, tileWidth) / tileWidth; y = this.game.math.snapToFloor(y, tileHeight) / tileHeight; - if (x >= 0 && x < this.layers[this.currentLayer].width && y >= 0 && y < this.layers[this.currentLayer].height) + if (x >= 0 && x < this.layers[layer].width && y >= 0 && y < this.layers[layer].height) { - this.layers[this.currentLayer].data[y][x] = index; + this.layers[layer].data[y][x] = index; } this.dirty = true;