Skip to content

Commit e4faa34

Browse files
committed
Merge pull request phaserjs#188 from Izzimach/izz
Switched Tilemap to use user-specified layer.
2 parents 71b08ca + 1d20c07 commit e4faa34

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/tilemap/Tilemap.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ Phaser.Tilemap.prototype = {
114114

115115
if (typeof layer === "undefined") { layer = this.currentLayer; }
116116

117-
if (x >= 0 && x < this.layers[this.currentLayer].width && y >= 0 && y < this.layers[this.currentLayer].height)
117+
if (x >= 0 && x < this.layers[layer].width && y >= 0 && y < this.layers[layer].height)
118118
{
119-
this.layers[this.currentLayer].data[y][x] = index;
119+
this.layers[layer].data[y][x] = index;
120120
}
121121

122122
this.dirty = true;
@@ -127,9 +127,9 @@ Phaser.Tilemap.prototype = {
127127

128128
if (typeof layer === "undefined") { layer = this.currentLayer; }
129129

130-
if (x >= 0 && x < this.layers[this.currentLayer].width && y >= 0 && y < this.layers[this.currentLayer].height)
130+
if (x >= 0 && x < this.layers[layer].width && y >= 0 && y < this.layers[layer].height)
131131
{
132-
return this.layers[this.currentLayer].data[y][x];
132+
return this.layers[layer].data[y][x];
133133
}
134134

135135
},
@@ -141,9 +141,9 @@ Phaser.Tilemap.prototype = {
141141
x = this.game.math.snapToFloor(x, tileWidth) / tileWidth;
142142
y = this.game.math.snapToFloor(y, tileHeight) / tileHeight;
143143

144-
if (x >= 0 && x < this.layers[this.currentLayer].width && y >= 0 && y < this.layers[this.currentLayer].height)
144+
if (x >= 0 && x < this.layers[layer].width && y >= 0 && y < this.layers[layer].height)
145145
{
146-
return this.layers[this.currentLayer].data[y][x];
146+
return this.layers[layer].data[y][x];
147147
}
148148

149149
},
@@ -160,9 +160,9 @@ Phaser.Tilemap.prototype = {
160160
x = this.game.math.snapToFloor(x, tileWidth) / tileWidth;
161161
y = this.game.math.snapToFloor(y, tileHeight) / tileHeight;
162162

163-
if (x >= 0 && x < this.layers[this.currentLayer].width && y >= 0 && y < this.layers[this.currentLayer].height)
163+
if (x >= 0 && x < this.layers[layer].width && y >= 0 && y < this.layers[layer].height)
164164
{
165-
this.layers[this.currentLayer].data[y][x] = index;
165+
this.layers[layer].data[y][x] = index;
166166
}
167167

168168
this.dirty = true;

0 commit comments

Comments
 (0)