Phaser API Documentation

getTileAtWorldXY(worldX, worldY, [nonNull], [camera])


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


name type arguments Default 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 <optional> false

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

camera Phaser.Cameras.Scene2D.Camera <optional>

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


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

Since: 3.50.0