Optionalconfig: LayerDataConfig
The Layer Data configuration object.
The alpha value of the layer.
The base tile height, in pixels. This is the tile height defined at the map level and
is used to calculate pixel coordinates and layer dimensions. It defaults to tileHeight
but may differ for layers that use a different tile size than the map default.
The base tile width, in pixels. This is the tile width defined at the map level and
is used to calculate pixel coordinates and layer dimensions. It defaults to tileWidth
but may differ for layers that use a different tile size than the map default.
An array of physics bodies.
An array of tile location callbacks registered for this layer. Each entry maps a tile index to a callback function that is invoked when a physics-enabled Game Object overlaps or collides with that tile.
Tile Collision ID index map.
A 2D array of Tile objects representing the tile grid for this layer. Indexed as data[row][col],
where each entry is a Tile instance (or null for an empty cell).
The height of the layer in tiles.
The height in pixels of the entire layer.
The length of the horizontal sides of the hexagon. Only used for hexagonal orientation Tilemaps.
The id of the layer, as specified in the map data.
Note: This is not the index of the layer in the map data, but its actual ID in Tiled.
Tile ID index map.
The name of the layer, if specified in Tiled.
The layer's orientation, necessary to be able to determine a tile's pixelX and pixelY as well as the layer's width and height.
Layer specific properties (can be specified in Tiled).
The Stagger Axis as defined in Tiled.
Only used for hexagonal orientation Tilemaps.
The Stagger Index as defined in Tiled.
Either 'odd' or 'even'.
Only used for hexagonal orientation Tilemaps.
The pixel height of the tiles.
A reference to the Tilemap layer that owns this data.
The pixel width of the tiles.
Is the layer visible or not?
The width of the layer in tiles.
The width in pixels of the entire layer.
The x offset of where to draw from the top left.
The y offset of where to draw from the top left.
Stores all data associated with a single layer in a tilemap. When a map is parsed from CSV, Tiled JSON, or other formats, each tile layer is converted into a LayerData instance that holds the tile grid, layer dimensions, orientation, visibility, physics bodies, tile callbacks, and any custom properties defined in the editor.
Both
TilemapandTilemapLayerhold a reference to LayerData and use it to look up tile positions, perform collision checks, and drive rendering.