Namespace: Tiled

Phaser.Tilemaps.Parsers. Tiled

Methods


<static> AssignTileProperties(mapData)

Copy properties from tileset to tiles.

Parameters:
Name Type Description
mapData Phaser.Tilemaps.MapData

[description]

Since: 3.0.0
Source: src/tilemaps/parsers/tiled/AssignTileProperties.js (Line 9)

<static> Base64Decode(data)

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

Parameters:
Name Type Description
data object

Base-64 encoded data to decode.

Since: 3.0.0
Source: src/tilemaps/parsers/tiled/Base64Decode.js (Line 7)
Returns:

Array containing the decoded bytes.

Type
array

<static> BuildTilesetIndex(mapData)

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

Parameters:
Name Type Description
mapData Phaser.Tilemaps.MapData

[description]

Since: 3.0.0
Source: src/tilemaps/parsers/tiled/BuildTilesetIndex.js (Line 7)
Returns:

[description]

Type
array

<static> ParseGID(gid)

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

Parameters:
Name Type Description
gid number

[description]

Since: 3.0.0
Source: src/tilemaps/parsers/tiled/ParseGID.js (Line 11)
Returns:

[description]

Type
object

<static> ParseImageLayers(json)

[description]

Parameters:
Name Type Description
json object

[description]

Since: 3.0.0
Source: src/tilemaps/parsers/tiled/ParseImageLayers.js (Line 9)
Returns:

[description]

Type
array

<static> ParseJSONTiled(name, json, insertNull)

Parses a Tiled JSON object into a new MapData object.

Parameters:
Name Type Description
name string

The name of the tilemap, used to set the name on the MapData.

json object

The Tiled JSON object.

insertNull boolean

Controls 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.

Since: 3.0.0
Source: src/tilemaps/parsers/tiled/ParseJSONTiled.js (Line 20)
Returns:

The created MapData object, or null if the data can't be parsed.

Type
Phaser.Tilemaps.MapData

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

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:
Name Type Argument Default Description
tiledObject object

Tiled object to convert to an internal parsed object normalising and copying properties over.

offsetX number <optional>
0

Optional additional offset to apply to the object's x property. Defaults to 0.

offsetY number <optional>
0

Optional additional offset to apply to the object's y property. Defaults to 0.

Since: 3.0.0
Source: src/tilemaps/parsers/tiled/ParseObject.js (Line 14)
Returns:

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.

Type
object

<static> ParseObjectLayers(json)

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

Parameters:
Name Type Description
json object

The Tiled JSON object.

Since: 3.0.0
Source: src/tilemaps/parsers/tiled/ParseObjectLayers.js (Line 11)
Returns:

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

Type
array

<static> ParseTileLayers(json, insertNull)

[description]

Parameters:
Name Type Description
json object

[description]

insertNull boolean

[description]

Since: 3.0.0
Source: src/tilemaps/parsers/tiled/ParseTileLayers.js (Line 13)
Returns:

[description]

Type
array

<static> ParseTilesets(json)

Tilesets & Image Collections

Parameters:
Name Type Description
json object

[description]

Since: 3.0.0
Source: src/tilemaps/parsers/tiled/ParseTilesets.js (Line 11)
Returns:

[description]

Type
object

<static> Pick(object, keys)

Returns a new object that only contains the keys that were found on the object provided. If no keys are found, an empty object is returned.

Parameters:
Name Type Description
object object

The object to pick the provided keys from.

keys array

An array of properties to retrieve from the provided object.

Since: 3.0.0
Source: src/tilemaps/parsers/tiled/Pick.js (Line 9)
Returns:

A new object that only contains the keys that were found on the provided object. If no keys were found, an empty object will be returned.

Type
object