- Source: src/tilemaps/parsers/tiled/index.js (Line 7)
Methods
-
<static> AssignTileProperties(mapData)
-
Copy properties from tileset to tiles.
Parameters:
Name Type Description mapDataPhaser.Tilemaps.MapData The Map Data object.
- 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 dataobject 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 mapDataPhaser.Tilemaps.MapData The Map Data object.
- Since: 3.0.0
- Source: src/tilemaps/parsers/tiled/BuildTilesetIndex.js (Line 9)
Returns:
An array of Tileset objects.
- Type
- array
-
<static> CreateGroupLayer(json [, currentl] [, parentstate])
-
Parse a Tiled group layer and create a state object for inheriting.
Parameters:
Name Type Argument Description jsonobject The Tiled JSON object.
currentlobject <optional>
The current group layer from the Tiled JSON file.
parentstateobject <optional>
The state of the parent group (if any).
- Since: 3.21.0
- Source: src/tilemaps/parsers/tiled/CreateGroupLayer.js (Line 9)
Returns:
A group state object with proper values for updating children layers.
- Type
- object
-
<static> ParseGID(gid)
-
See Tiled documentation on tile flipping: http://docs.mapeditor.org/en/latest/reference/tmx-map-format/
Parameters:
Name Type Description gidnumber A Tiled GID.
- Since: 3.0.0
- Source: src/tilemaps/parsers/tiled/ParseGID.js (Line 11)
Returns:
The GID Data.
-
<static> ParseImageLayers(json)
-
Parses a Tiled JSON object into an array of objects with details about the image layers.
Parameters:
Name Type Description jsonobject The Tiled JSON object.
- Since: 3.0.0
- Source: src/tilemaps/parsers/tiled/ParseImageLayers.js (Line 10)
Returns:
Array of objects that include critical info about the map's image layers
- Type
- array
-
<static> ParseJSONTiled(name, json, insertNull)
-
Parses a Tiled JSON object into a new MapData object.
Parameters:
Name Type Description namestring The name of the tilemap, used to set the name on the MapData.
jsonobject The Tiled JSON object.
insertNullboolean Controls how empty tiles, tiles with an index of -1, in the map data are handled. If
true, empty locations will get a value ofnull. Iffalse, 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 totruewill 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 18)
Returns:
The created MapData object, or
nullif the data can't be parsed. -
<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,widthandheight. Other properties will be added according to the object type (such as text, polyline, gid etc.)Parameters:
Name Type Argument Default Description tiledObjectobject Tiled object to convert to an internal parsed object normalising and copying properties over.
offsetXnumber <optional>
0 Optional additional offset to apply to the object's x property. Defaults to 0.
offsetYnumber <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 jsonobject The Tiled JSON object.
- Since: 3.0.0
- Source: src/tilemaps/parsers/tiled/ParseObjectLayers.js (Line 12)
Returns:
An array of all object layers in the tilemap as
ObjectLayers.- Type
- array
-
<static> ParseTileLayers(json, insertNull)
-
Parses all tilemap layers in a Tiled JSON object into new LayerData objects.
Parameters:
Name Type Description jsonobject The Tiled JSON object.
insertNullboolean Controls how empty tiles, tiles with an index of -1, in the map data are handled (see Phaser.Tilemaps.Parsers.Tiled.ParseJSONTiled).
- Since: 3.0.0
- Source: src/tilemaps/parsers/tiled/ParseTileLayers.js (Line 16)
Returns:
- An array of LayerData objects, one for each entry in json.layers with the type 'tilelayer'.
- Type
- Array.<Phaser.Tilemaps.LayerData>
-
<static> ParseTilesets(json)
-
Tilesets and Image Collections
Parameters:
Name Type Description jsonobject The Tiled JSON data.
- Since: 3.0.0
- Source: src/tilemaps/parsers/tiled/ParseTilesets.js (Line 11)
Returns:
An object containing the tileset and image collection data.
- Type
- object
