Adds an image to the map to be used as a tileset. A single map may use multiple tilesets. Note that the tileset name can be found in the JSON file exported from Tiled, or in the Tiled editor.
name | type | arguments | Default | description |
---|---|---|---|---|
tilesetName | string |
The name of the tileset as specified in the map data. |
||
key | string | <optional> |
The key of the Phaser.Cache image used for this tileset. If
|
|
tileWidth | number | <optional> |
The width of the tile (in pixels) in the Tileset Image. If not given it will default to the map's tileWidth value, or the tileWidth specified in the Tiled JSON file. |
|
tileHeight | number | <optional> |
The height of the tiles (in pixels) in the Tileset Image. If not given it will default to the map's tileHeight value, or the tileHeight specified in the Tiled JSON file. |
|
tileMargin | number | <optional> |
The margin around the tiles in the sheet (in pixels). If not specified, it will default to 0 or the value specified in the Tiled JSON file. |
|
tileSpacing | number | <optional> |
The spacing between each the tile in the sheet (in pixels). If not specified, it will default to 0 or the value specified in the Tiled JSON file. |
|
gid | number | <optional> | 0 |
If adding multiple tilesets to a blank map, specify the starting GID this set will use here. |
tileOffset | object | <optional> | {x: 0, y: 0} |
Tile texture drawing offset. If not specified, it will default to {0, 0} |
Returns the Tileset object that was created or updated, or null if it failed.