- Source: src/tilemaps/parsers/index.js (Line 7)
Namespaces
Methods
-
<static> FromOrientationString( [orientation])
-
Get the Tilemap orientation from the given string.
Parameters:
Name Type Argument Description orientationstring <optional>
The orientation type as a string.
- Since: 3.50.0
- Source: src/tilemaps/parsers/FromOrientationString.js (Line 9)
Returns:
The Tilemap Orientation type.
-
<static> Parse(name, mapFormat, data, tileWidth, tileHeight, insertNull)
-
Parses raw data of a given Tilemap format into a new MapData object. If no recognized data format is found, returns
null. When loading from CSV or a 2D array, you should specify the tileWidth & tileHeight. When parsing from a map from Tiled, the tileWidth & tileHeight will be pulled from the map data.Parameters:
Name Type Description namestring The name of the tilemap, used to set the name on the MapData.
mapFormatnumber See ../Formats.js.
dataArray.<Array.<number>> | string | object 2D array, CSV string or Tiled JSON object.
tileWidthnumber The width of a tile in pixels. Required for 2D array and CSV, but ignored for Tiled JSON.
tileHeightnumber The height of a tile in pixels. Required for 2D array and CSV, but ignored for Tiled JSON.
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/Parse.js (Line 13)
Returns:
The created
MapDataobject. -
<static> Parse2DArray(name, data, tileWidth, tileHeight, insertNull)
-
Parses a 2D array of tile indexes into a new MapData object with a single layer.
Parameters:
Name Type Description namestring The name of the tilemap, used to set the name on the MapData.
dataArray.<Array.<number>> 2D array, CSV string or Tiled JSON object.
tileWidthnumber The width of a tile in pixels.
tileHeightnumber The height of a tile in pixels.
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/Parse2DArray.js (Line 12)
Returns:
The MapData object.
-
<static> ParseCSV(name, data, tileWidth, tileHeight, insertNull)
-
Parses a CSV string of tile indexes into a new MapData object with a single layer.
Parameters:
Name Type Description namestring The name of the tilemap, used to set the name on the MapData.
datastring CSV string of tile indexes.
tileWidthnumber The width of a tile in pixels.
tileHeightnumber The height of a tile in pixels.
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/ParseCSV.js (Line 10)
Returns:
The resulting MapData object.
