mirror of
https://github.com/photonstorm/phaser
synced 2025-01-11 04:38:51 +00:00
16 lines
509 B
JavaScript
16 lines
509 B
JavaScript
|
var GetTileAt = require('./GetTileAt');
|
||
|
var SnapFloor = require('../../../math/snap/SnapFloor');
|
||
|
|
||
|
// NOTE: phaser v2 version doesn't account for TilemapLayer's XY, so neither does this version
|
||
|
// currently.
|
||
|
|
||
|
var GetTileAtWorldXY = function (worldX, worldY, nonNull, layer)
|
||
|
{
|
||
|
var tileX = SnapFloor(worldX, layer.tileWidth) / layer.tileWidth;
|
||
|
var tileY = SnapFloor(worldY, layer.tileHeight) / layer.tileHeight;
|
||
|
|
||
|
return GetTileAt(tileX, tileY, nonNull, layer);
|
||
|
};
|
||
|
|
||
|
module.exports = GetTileAtWorldXY;
|