Phaser API Documentation

<static> GetTileAtWorldXY(worldX, worldY, nonNull, camera, layer)


Gets a tile at the given world coordinates from the given layer.


name type description
worldX number

X position to get the tile from (given in pixels)

worldY number

Y position to get the tile from (given in pixels)

nonNull boolean

If true, function won't return null for empty tiles, but a Tile object with an index of -1.

camera Phaser.Cameras.Scene2D.Camera

The Camera to use when calculating the tile index from the world values.

layer Phaser.Tilemaps.LayerData

The Tilemap Layer to act upon.


The tile at the given coordinates or null if no tile was found or the coordinates were invalid.

Since: 3.0.0