Phaser API Documentation

  Version: 
getTileCorners(tileX, tileY, [camera], [layer])

Description:

Returns an array of Vector2s where each entry corresponds to the corner of the requested tile.

The tileX and tileY parameters are in tile coordinates, not world coordinates.

The corner coordinates are in world space, having factored in TilemapLayer scale, position and the camera, if given.

The size of the array will vary based on the orientation of the map. For example an orthographic map will return an array of 4 vectors, where-as a hexagonal map will, of course, return an array of 6 corner vectors.

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

Parameters:

name type arguments description
tileX number

The x coordinate, in tiles, not pixels.

tileY number

The y coordinate, in tiles, not pixels.

camera Phaser.Cameras.Scene2D.Camera <optional>

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

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

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

Returns:
Description:

Returns an array of Vector2s, or null if the layer given was invalid.

Type:
Since: 3.60.0
Source: src/tilemaps/Tilemap.js (Line 2506)