Class: TilemapParser

Phaser. TilemapParser

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, tileWidth, tileHeight, width, height) → {object}

Parse tilemap data from the cache and creates a Tilemap object.

Parameters:
Name Type Argument Default Description
game Phaser.Game

Game reference to the currently running game.

key string

The key of the tilemap in the Cache.

tileWidth number <optional>
32

The pixel width of a single map tile. If using CSV data you must specify this. Not required if using Tiled map data.

tileHeight number <optional>
32

The pixel height of a single map tile. If using CSV data you must specify this. Not required if using Tiled map data.

width number <optional>
10

The width of the map in tiles. If this map is created from Tiled or CSV data you don't need to specify this.

height number <optional>
10

The height of the map in tiles. If this map is created from Tiled or CSV data you don't need to specify this.

Source:
Returns:

The parsed map object.

Type
object

<static> parseCSV(data, tileWidth, tileHeight) → {object}

Parses a CSV file into valid map data.

Parameters:
Name Type Argument Default Description
data string

The CSV file data.

tileWidth number <optional>
32

The pixel width of a single map tile. If using CSV data you must specify this. Not required if using Tiled map data.

tileHeight number <optional>
32

The pixel height of a single map tile. If using CSV data you must specify this. Not required if using Tiled map 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
Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev on Fri Mar 28 2014 01:41:40 GMT-0000 (GMT) using the DocStrap template.