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 tilemap data from the cache and creates a Tilemap object.
Parameters:
Name Type Description game
Phaser.Game Game reference to the currently running game.
key
string 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 data
string 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 json
object 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 game
Phaser.Game Game reference to the currently running game.
key
string The Cache key of this tileset.
tileWidth
number Width of each single tile in pixels.
tileHeight
number Height of each single tile in pixels.
tileMargin
number <optional>
0 If the tiles have been drawn with a margin, specify the amount here.
tileSpacing
number <optional>
0 If the tiles have been drawn with spacing between them, specify the amount here.
rows
number <optional>
-1 How many tiles are placed horizontally in each row? If -1 it will calculate rows by dividing the image width by tileWidth.
columns
number <optional>
-1 How many tiles are placed vertically in each column? If -1 it will calculate columns by dividing the image height by tileHeight.
total
number <optional>
-1 The maximum number of tiles to extract from the image. If -1 it will extract
rows * columns
worth. You can also set a value lower than the actual number of tiles.- Source:
Returns:
Generated Tileset object.
- Type
- Phaser.Tileset