Skip to content

Commit 55dc748

Browse files
committed
Tilemap.getTile and getTileXY used to return null in 2.0.3 but returned a Tile object in 2.0.4 (with an index of -1), they now return null again.
1 parent fa613c5 commit 55dc748

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ Version 2.0.5 - "Tanchico" - in development
6363
* ScaleManager seeds _check private var with null to avoid later comparison check (thanks @jflowers45, fix #782)
6464
* P2.Body.applyForce should have used pxmi instead of pxm (thanks @Trufi, fix #776)
6565
* P2 fixed creation of RevoluteConstraint by passing maxForce in the options (thanks @woutercommandeur, fix #783)
66+
* Tilemap.getTile and getTileXY used to return `null` in 2.0.3 but returned a Tile object in 2.0.4 (with an index of -1), they now return `null` again.
6667

6768

6869
There is an extensive [Migration Guide](https://github.com/photonstorm/phaser/blob/master/resources/Migration%20Guide.md) available for those converting from Phaser 1.x to 2.x. In the guide we detail the API breaking changes and approach to our new physics system.

src/tilemap/Tilemap.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,14 @@ Phaser.Tilemap.prototype = {
11841184

11851185
if (x >= 0 && x < this.layers[layer].width && y >= 0 && y < this.layers[layer].height)
11861186
{
1187-
return this.layers[layer].data[y][x];
1187+
if (this.layers[layer].data[y][x].index === -1)
1188+
{
1189+
return null;
1190+
}
1191+
else
1192+
{
1193+
return this.layers[layer].data[y][x];
1194+
}
11881195
}
11891196

11901197
},

0 commit comments

Comments
 (0)