Phaser API Documentation

getTilesWithinWorldXY(worldX, worldY, width, height, [filteringOptions], [camera], [layer])


Gets the tiles in the given rectangular area (in world coordinates) of the layer.

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


name type arguments description
worldX number

The world x coordinate for the top-left of the area.

worldY number

The world y coordinate for the top-left of the area.

width number

The width of the area.

height number

The height of the area.

filteringOptions Phaser.Types.Tilemaps.FilteringOptions <optional>

Optional filters to apply when getting the tiles.

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 an array of Tiles, or null if the layer given was invalid.

Since: 3.0.0
Source: src/tilemaps/Tilemap.js (Line 1414)