mirror of
https://github.com/photonstorm/phaser
synced 2024-12-23 19:43:28 +00:00
24 lines
442 B
JavaScript
24 lines
442 B
JavaScript
|
var GetTileAt = function (x, y, layer, nonNull)
|
||
|
{
|
||
|
if (nonNull === undefined) { nonNull = false; }
|
||
|
|
||
|
if (x >= 0 && x < layer.width && y >= 0 && y < layer.height)
|
||
|
{
|
||
|
var tile = layer.data[y][x];
|
||
|
if (tile.index === -1)
|
||
|
{
|
||
|
return nonNull ? tile : null;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return tile;
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return null;
|
||
|
}
|
||
|
};
|
||
|
|
||
|
module.exports = GetTileAt;
|