addTilesetImage(tileset, key, tileWidth, tileHeight, tileMargin, tileSpacing, gid) → {Phaser.Tileset}
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.
Parameters
| Name | Type | Argument | Default | Description | 
|---|---|---|---|---|
tileset |  string | The name of the tileset as specified in the map data.  |  ||
key |  string | Phaser.BitmapData |  <optional> |  The key of the Phaser.Cache image used for this tileset.  |  |
tileWidth |  number |  <optional> |  32 | The width of the tiles in the Tileset Image. If not given it will default to the map.tileWidth value, if that isn't set then 32.  |  
tileHeight |  number |  <optional> |  32 | The height of the tiles in the Tileset Image. If not given it will default to the map.tileHeight value, if that isn't set then 32.  |  
tileMargin |  number |  <optional> |  0 | The width of the tiles in the Tileset Image.  |  
tileSpacing |  number |  <optional> |  0 | The height of the tiles in the Tileset Image.  |  
gid |  number |  <optional> |  0 | If adding multiple tilesets to a blank/dynamic map, specify the starting GID the set will use here.  |  
Returns
Returns the Tileset object that was created or updated, or null if it failed.
- Source code: tilemap/Tilemap.js (Line 253)
 
Please login to continue.