TileSet
TileSet represents a collection of tiles and associated metadata. Access via the 'tilemap' submodule.
Properties
| Name | Description | Type |
|---|---|---|
columns | Number of tile columns in the source image. | int |
first_gid | First global tile id (GID) in this tileset. | int |
last_gid | Last global tile id (GID) in this tileset. | int |
margin | Pixel margin around the source image. | int |
name | Tileset name. | str |
spacing | Pixel spacing between tiles in the source image. | int |
terrains | TerrainList of terrain definitions. | list[TileSet.Terrain] |
texture | Source texture for the tileset. | Texture |
tile_count | Total number of tiles in the tileset. | int |
tile_offset | Per-tile offset applied when rendering. | Vec2 |
tile_size | Size of tiles in pixels. | Vec2 |
tiles | TileSetTileList of tile metadata entries. | list[TileSet.Tile] |
Methods
Get Tile
get_tile(id: SupportsInt) → TileSet.TileRetrieve tile metadata for a given id.
Args
id: Global tile id (GID).
Returns
Tile : The tile metadata, or None if not found.
Has Tile
has_tile(id: SupportsInt) → boolCheck whether a global tile id belongs to this tileset.
Args
id: Global tile id (GID).
Returns
bool : True if the tileset contains the tile id, False otherwise.