new TilemapParser()
Phaser.TilemapParser parses data objects from Phaser.Loader that need more preparation before they can be inserted into a Tilemap.
- Source:
Methods
-
<static> getEmptyData() → {object}
-
Returns an empty map data object.
- Source:
Returns:
Generated map data.
- Type
- object
-
<static> parse(game, key) → {object}
-
Parse tileset data from the cache and creates a Tileset object.
Parameters:
Name Type Description gamePhaser.Game Game reference to the currently running game.
keystring The key of the tilemap in the Cache.
- Source:
Returns:
The parsed map object.
- Type
- object
-
<static> parseCSV(data) → {object}
-
Parses a CSV file into valid map data.
Parameters:
Name Type Description datastring The CSV file data.
- Source:
Returns:
Generated map data.
- Type
- object
-
<static> parseJSON(json) → {object}
-
Parses a Tiled JSON file into valid map data.
Parameters:
Name Type Description jsonobject The JSON map data.
- Source:
Returns:
Generated and parsed map data.
- Type
- object
-
<static> tileset(game, key, tileWidth, tileHeight, tileMargin, tileSpacing, rows, columns, total) → {Phaser.Tileset}
-
Creates a Tileset object.
Parameters:
Name Type Argument Default Description gamePhaser.Game Game reference to the currently running game.
keystring The Cache key of this tileset.
tileWidthnumber Width of each single tile in pixels.
tileHeightnumber Height of each single tile in pixels.
tileMarginnumber <optional>
0 If the tiles have been drawn with a margin, specify the amount here.
tileSpacingnumber <optional>
0 If the tiles have been drawn with spacing between them, specify the amount here.
rowsnumber <optional>
-1 How many tiles are placed horizontally in each row? If -1 it will calculate rows by dividing the image width by tileWidth.
columnsnumber <optional>
-1 How many tiles are placed vertically in each column? If -1 it will calculate columns by dividing the image height by tileHeight.
totalnumber <optional>
-1 The maximum number of tiles to extract from the image. If -1 it will extract
rows * columnsworth. You can also set a value lower than the actual number of tiles.- Source:
Returns:
Generated Tileset object.
- Type
- Phaser.Tileset