Phaser API Documentation

hasTileAtWorldXY(worldX, worldY, [camera], [layer])


Checks if there is a tile at the given location (in world coordinates) in the given layer. Returns false if there is no tile or if the tile at that location has an index of -1.

If no layer is specified, the maps current layer is used.


name type arguments description
worldX number

The x coordinate, in pixels.

worldY number

The y coordinate, in pixels.

camera Phaser.Cameras.Scene2D.Camera <optional>

The Camera to use when factoring in which tiles to return.

layer string | number | Phaser.Tilemaps.TilemapLayer <optional>

The tile layer to use. If not given the current layer is used.


Returns a boolean, or null if the layer given was invalid.

  • boolean
Since: 3.0.0
Source: src/tilemaps/Tilemap.js (Line 1498)