Phaser API Documentation

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

Description:

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.

Parameters:

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:
Description:

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

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