Phaser API Documentation

tileToWorldXY(tileX, tileY, [vec2], [camera], [layer])


Converts from tile XY coordinates (tile units) to world XY coordinates (pixels), factoring in the layers position, scale and scroll. This will return a new Vector2 object or update the given point object.

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


name type arguments description
tileX number

The x coordinate, in tiles, not pixels.

tileY number

The y coordinate, in tiles, not pixels.

vec2 Phaser.Math.Vector2 <optional>

A Vector2 to store the coordinates in. If not given a new Vector2 is created.

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 a Vector2, or null if the layer given was invalid.

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