Phaser API Documentation

  Version: 
Filter
This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord

Phaser . Tilemaps . MapData

This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord

Phaser . Tilemaps . MapData

A class for representing data about a map. Maps are parsed from CSV, Tiled, etc. into this format. A Tilemap object get a copy of this data and then unpacks the needed properties into itself.

Constructor:

new MapData([config])

Parameters:

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

The Map configuration object.

Since: 3.0.0

Members

collision: object
Focus
Focus

Description:

An object of collision data. Must be created as physics object or will return undefined.

Type:
object
Since: 3.0.0
Focus
Focus
format: number
Focus
Focus

Description:

The format of the map data.

Type:
number
Since: 3.0.0
Focus
Focus
height: number
Focus
Focus

Description:

The height of the entire tilemap.

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

Description:

The height in pixels of the entire tilemap.

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
imageCollections: array
Focus
Focus

Description:

The collection of images the map uses(specified in Tiled)

Type:
array
Since: 3.0.0
Focus
Focus
images: array
Focus
Focus

Description:

An array of Tiled Image Layers.

Type:
array
Since: 3.0.0
Focus
Focus
infinite: boolean
Focus
Focus

Description:

If the map is infinite or not.

Type:
boolean
Since: 3.17.0
Focus
Focus

Description:

An array with all the layers configured to the MapData.

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

Description:

The key in the Phaser cache that corresponds to the loaded tilemap data.

Type:
string
Since: 3.0.0
Focus
Focus
objects: object
Focus
Focus

Description:

An object of Tiled Object Layers.

Type:
object
Since: 3.0.0
Focus
Focus

Description:

The orientation of the map data (i.e. orthogonal, isometric, hexagonal), default 'orthogonal'.

Type:
Since: 3.50.0
Focus
Focus
properties: object
Focus
Focus

Description:

Map specific properties (can be specified in Tiled)

Type:
object
Since: 3.0.0
Focus
Focus
renderOrder: string
Focus
Focus

Description:

Determines the draw order of tilemap. Default is right-down

0, or 'right-down' 1, or 'left-down' 2, or 'right-up' 3, or 'left-up'

Type:
string
Since: 3.12.0
Focus
Focus
tileHeight: number
Focus
Focus

Description:

The height of the tiles.

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

Description:

The width of the tiles.

Type:
number
Since: 3.0.0
Focus
Focus
tiles: array
Focus
Focus

Description:

An array of tile instances.

Type:
array
Since: 3.0.0
Focus
Focus
tilesets: Array.<Phaser.Tilemaps.Tileset>
Focus
Focus

Description:

An array of Tilesets.

Type:
Since: 3.0.0
Focus
Focus
version: string
Focus
Focus

Description:

The version of the map data (as specified in Tiled).

Type:
string
Since: 3.0.0
Focus
Focus
width: number
Focus
Focus

Description:

The width of the entire tilemap.

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

Description:

The width in pixels of the entire tilemap.

Type:
number
Since: 3.0.0
Focus
Focus