mirror of
https://github.com/photonstorm/phaser
synced 2025-01-11 12:48:50 +00:00
23 lines
442 B
JavaScript
23 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;
|