Phaser.Tilemaps.Parsers.Tiled

Scope: static

Source: src/tilemaps/parsers/tiled/index.js#L7

Methods:

Public Members

AssignTileProperties

<static> AssignTileProperties(mapData)

Description:

Copy properties from tileset to tiles.

Parameters:

nametypeoptionaldescription
mapDataPhaser.Tilemaps.MapDataNoThe Map Data object.

Source: src/tilemaps/parsers/tiled/AssignTileProperties.js#L9
Since: 3.0.0


Base64Decode

<static> Base64Decode(data)

Description:

Decode base-64 encoded data, for example as exported by Tiled.

Parameters:

nametypeoptionaldescription
dataobjectNoBase-64 encoded data to decode.

Returns: array - Array containing the decoded bytes.

Source: src/tilemaps/parsers/tiled/Base64Decode.js#L7
Since: 3.0.0


BuildTilesetIndex

<static> BuildTilesetIndex(mapData)

Description:

Master list of tiles -> x, y, index in tileset.

Parameters:

nametypeoptionaldescription
mapDataPhaser.Tilemaps.MapData | Phaser.Tilemaps.TilemapNoThe Map Data object.

Returns: array - An array of Tileset objects.

Source: src/tilemaps/parsers/tiled/BuildTilesetIndex.js#L9
Since: 3.0.0


CreateGroupLayer

<static> CreateGroupLayer(json, [group], [parentState])

Description:

Parse a Tiled group layer and create a state object for inheriting.

Parameters:

nametypeoptionaldescription
jsonobjectNoThe Tiled JSON object.
groupobjectYesThe current group layer from the Tiled JSON file.
parentStateobjectYesThe state of the parent group (if any).

Returns: object - A group state object with proper values for updating children layers.

Source: src/tilemaps/parsers/tiled/CreateGroupLayer.js#L9
Since: 3.21.0


ParseGID

<static> ParseGID(gid)

Description:

See Tiled documentation on tile flipping: http://docs.mapeditor.org/en/latest/reference/tmx-map-format/

Parameters:

nametypeoptionaldescription
gidnumberNoA Tiled GID.

Returns: Phaser.Types.Tilemaps.GIDData - The GID Data.

Source: src/tilemaps/parsers/tiled/ParseGID.js#L11
Since: 3.0.0


ParseImageLayers

<static> ParseImageLayers(json)

Description:

Parses a Tiled JSON object into an array of objects with details about the image layers.

Parameters:

nametypeoptionaldescription
jsonobjectNoThe Tiled JSON object.

Returns: array - Array of objects that include critical info about the map's image layers

Source: src/tilemaps/parsers/tiled/ParseImageLayers.js#L10
Since: 3.0.0


ParseJSONTiled

<static> ParseJSONTiled(name, source, insertNull)

Description:

Parses a Tiled JSON object into a new MapData object.

Parameters:

nametypeoptionaldescription
namestringNoThe name of the tilemap, used to set the name on the MapData.
sourceobjectNoThe original Tiled JSON object. This is deep copied by this function.
insertNullbooleanNoControls how empty tiles, tiles with an index of -1, in the map data are handled. If true, empty locations will get a value of null. If false, empty location will get a Tile object with an index of -1. If you've a large sparsely populated map and the tile data doesn't need to change then setting this value to true will help with memory consumption. However if your map is small or you need to update the tiles dynamically, then leave the default value set.

Returns: Phaser.Tilemaps.MapData - The created MapData object, or null if the data can't be parsed.

Source: src/tilemaps/parsers/tiled/ParseJSONTiled.js#L19
Since: 3.0.0


ParseObject

<static> ParseObject(tiledObject, [offsetX], [offsetY])

Description:

Convert a Tiled object to an internal parsed object normalising and copying properties over, while applying optional x and y offsets. The parsed object will always have the properties id, name, type, rotation, properties, visible, x, y, width and height. Other properties will be added according to the object type (such as text, polyline, gid etc.)

Parameters:

nametypeoptionaldefaultdescription
tiledObjectobjectNoTiled object to convert to an internal parsed object normalising and copying properties over.
offsetXnumberYes0Optional additional offset to apply to the object's x property. Defaults to 0.
offsetYnumberYes0Optional additional offset to apply to the object's y property. Defaults to 0.

Returns: object - The parsed object containing properties read from the Tiled object according to it's type with x and y values updated according to the given offsets.

Source: src/tilemaps/parsers/tiled/ParseObject.js#L14
Since: 3.0.0


ParseObjectLayers

<static> ParseObjectLayers(json)

Description:

Parses a Tiled JSON object into an array of ObjectLayer objects.

Parameters:

nametypeoptionaldescription
jsonobjectNoThe Tiled JSON object.

Returns: array - An array of all object layers in the tilemap as ObjectLayers.

Source: src/tilemaps/parsers/tiled/ParseObjectLayers.js#L12
Since: 3.0.0


ParseTileLayers

<static> ParseTileLayers(json, insertNull)

Description:

Parses all tilemap layers in a Tiled JSON object into new LayerData objects.

Parameters:

nametypeoptionaldescription
jsonobjectNoThe Tiled JSON object.
insertNullbooleanNoControls how empty tiles, tiles with an index of -1, in the map data are handled (see {@link Phaser.Tilemaps.Parsers.Tiled.ParseJSONTiled}).

Returns: Array.<Phaser.Tilemaps.LayerData> - - An array of LayerData objects, one for each entry in json.layers with the type 'tilelayer'.

Source: src/tilemaps/parsers/tiled/ParseTileLayers.js#L16
Since: 3.0.0


ParseTilesets

<static> ParseTilesets(json)

Description:

Tilesets and Image Collections.

Parameters:

nametypeoptionaldescription
jsonobjectNoThe Tiled JSON data.

Returns: object - An object containing the tileset and image collection data.

Source: src/tilemaps/parsers/tiled/ParseTilesets.js#L12
Since: 3.0.0


ParseWangsets

<static> ParseWangsets(wangsets, datas)

Description:

Parses out the Wangset information from Tiled 1.1.5+ map data, if present.

Since a given tile can be in more than one wangset, the resulting properties are nested. tile.data.wangid[someWangsetName] will return the array-based wang id in this implementation.

Note that we're not guaranteed that there will be any 'normal' tiles if the only thing in the tilset are wangtile definitions, so this has to be parsed separately.

See https://doc.mapeditor.org/en/latest/manual/using-wang-tiles/ for more information.

Parameters:

nametypeoptionaldescription
wangsetsArray.<object>NoThe array of wangset objects (parsed from JSON)
datasobjectNoThe field into which to put wangset data from Tiled.

Returns: object - An object containing the tileset and image collection data.

Source: src/tilemaps/parsers/tiled/ParseWangsets.js#L7
Since: 3.53.0


Private Members

Updated on