Phaser API Documentation

  Version: 
Filter

A class for representing data about about a layer in a map. Maps are parsed from CSV, Tiled, etc. into this format. Tilemap and TilemapLayer objects have a reference to this data and use it to look up and perform operations on tiles.

Constructor:

new LayerData([config])

Parameters:

name type arguments description
config Phaser.Types.Tilemaps.LayerDataConfig <optional>

The Layer Data configuration object.

Since: 3.0.0

Members

alpha: number
Focus
Focus

Description:

The alpha value of the layer.

Type:
number
Since: 3.0.0
Focus
Focus
baseTileHeight: number
Focus
Focus

Description:

The base tile height.

Type:
number
Since: 3.0.0
Focus
Focus
baseTileWidth: number
Focus
Focus

Description:

The base tile width.

Type:
number
Since: 3.0.0
Focus
Focus
bodies: array
Focus
Focus

Description:

An array of physics bodies.

Type:
array
Since: 3.0.0
Focus
Focus
callbacks: array
Focus
Focus

Description:

An array of callbacks.

Type:
array
Since: 3.0.0
Focus
Focus
collideIndexes: array
Focus
Focus

Description:

Tile Collision ID index map.

Type:
array
Since: 3.0.0
Focus
Focus
data: Array.<Array.<Phaser.Tilemaps.Tile>>
Focus
Focus

Description:

An array of the tile data indexes.

Type:
Array.<Array.<Phaser.Tilemaps.Tile>>
Since: 3.0.0
Focus
Focus
height: number
Focus
Focus

Description:

The height of the layer in tiles.

Type:
number
Since: 3.0.0
Focus
Focus
heightInPixels: number
Focus
Focus

Description:

The height in pixels of the entire layer.

Type:
number
Since: 3.0.0
Focus
Focus
hexSideLength: number
Focus
Focus

Description:

The length of the horizontal sides of the hexagon. Only used for hexagonal orientation Tilemaps.

Type:
number
Since: 3.50.0
Focus
Focus
indexes: array
Focus
Focus

Description:

Tile ID index map.

Type:
array
Since: 3.0.0
Focus
Focus
name: string
Focus
Focus

Description:

The name of the layer, if specified in Tiled.

Type:
string
Since: 3.0.0
Focus
Focus

Description:

The layers orientation, necessary to be able to determine a tiles pixelX and pixelY as well as the layers width and height.

Type:
Since: 3.50.0
Focus
Focus
properties: Array.<object>
Focus
Focus

Description:

Layer specific properties (can be specified in Tiled)

Type:
Array.<object>
Since: 3.0.0
Focus
Focus
staggerAxis: string
Focus
Focus

Description:

The Stagger Axis as defined in Tiled.

Only used for hexagonal orientation Tilemaps.

Type:
string
Since: 3.60.0
Focus
Focus
staggerIndex: string
Focus
Focus

Description:

The Stagger Index as defined in Tiled.

Either 'odd' or 'even'.

Only used for hexagonal orientation Tilemaps.

Type:
string
Since: 3.60.0
Focus
Focus
tileHeight: number
Focus
Focus

Description:

The pixel height of the tiles.

Type:
number
Since: 3.0.0
Focus
Focus
tileWidth: number
Focus
Focus

Description:

The pixel width of the tiles.

Type:
number
Since: 3.0.0
Focus
Focus

Description:

A reference to the Tilemap layer that owns this data.

Type:
Since: 3.0.0
Focus
Focus
visible: boolean
Focus
Focus

Description:

Is the layer visible or not?

Type:
boolean
Since: 3.0.0
Focus
Focus
width: number
Focus
Focus

Description:

The width of the layer in tiles.

Type:
number
Since: 3.0.0
Focus
Focus
widthInPixels: number
Focus
Focus

Description:

The width in pixels of the entire layer.

Type:
number
Since: 3.0.0
Focus
Focus
x: number
Focus
Focus

Description:

The x offset of where to draw from the top left.

Type:
number
Since: 3.0.0
Focus
Focus
y: number
Focus
Focus

Description:

The y offset of where to draw from the top left.

Type:
number
Since: 3.0.0
Focus
Focus