A Tile set is a combination of an image containing the tiles and collision data per tile.
Tilesets are normally created automatically when Tiled data is loaded.
Name | Type | Argument | Default | Description |
---|---|---|---|---|
name | string | The name of the tileset in the map data. | ||
firstgid | integer | The first tile index this tileset contains. | ||
width | integer | <optional> | 32 | Width of each tile (in pixels). |
height | integer | <optional> | 32 | Height of each tile (in pixels). |
margin | integer | <optional> | 0 | The margin around all tiles in the sheet (in pixels). |
spacing | integer | <optional> | 0 | The spacing between each tile in the sheet (in pixels). |
properties | object | <optional> | {} | Custom Tileset properties. |
The number of tile columns in the tileset.
The Tiled firstgid value.
This is the starting index of the first tile index this Tileset contains.
The cached image that contains the individual tiles. Use setImage to set.
The name of the Tileset.
Tileset-specific properties that are typically defined in the Tiled editor.
The number of tile rows in the the tileset.
Type | Description |
---|---|
integer |
The height of each tile (in pixels).
The margin around the tiles in the sheet (in pixels).
Use setSpacing
to change.
Name | Type | Description |
---|---|---|
tileMarge | integer |
The spacing between each tile in the sheet (in pixels).
Use setSpacing
to change.
The width of each tile (in pixels).
The total number of tiles in the tileset.
Returns true if and only if this tileset contains the given tile index.
True if this tileset contains the given index.
Draws a tile from this Tileset at the given coordinates on the context.
Name | Type | Description |
---|---|---|
context | CanvasRenderingContext2D | The context to draw the tile onto. |
x | number | The x coordinate to draw to. |
y | number | The y coordinate to draw to. |
index | integer | The index of the tile within the set to draw. |
Set the image associated with this Tileset and update the tile data.
Name | Type | Description |
---|---|---|
image | Image | The image that contains the tiles. |
Sets tile spacing and margins.
Name | Type | Argument | Default | Description |
---|---|---|---|---|
margin | integer | <optional> | 0 | The margin around the tiles in the sheet (in pixels). |
spacing | integer | <optional> | 0 | The spacing between the tiles in the sheet (in pixels). |
© 2016 Richard Davey, Photon Storm Ltd.
Licensed under the MIT License.
http://phaser.io/docs/2.6.2/Phaser.Tileset.html