Creates a Tilemap from the given key or data, or creates a blank Tilemap if no key/data provided. When loading from CSV or a 2D array, you should specify the tileWidth & tileHeight. When parsing from a map from Tiled, the tileWidth, tileHeight, width & height will be pulled from the map data. For an empty map, you should specify tileWidth, tileHeight, width & height.
name | type | arguments | Default | description |
---|---|---|---|---|
key | string | <optional> |
The key in the Phaser cache that corresponds to the loaded tilemap data. |
|
tileWidth | number | <optional> | 32 |
The width of a tile in pixels. Pass in |
tileHeight | number | <optional> | 32 |
The height of a tile in pixels. Pass in |
width | number | <optional> | 10 |
The width of the map in tiles. Pass in |
height | number | <optional> | 10 |
The height of the map in tiles. Pass in |
data | Array.<Array.<number>> | <optional> |
Instead of loading from the cache, you can also load directly from
a 2D array of tile indexes. Pass in |
|
insertNull | boolean | <optional> | false |
Controls how empty tiles, tiles with an index of -1, in the
map data are handled. If |