TileSet

TileSet represents a collection of tiles and associated metadata. Access via the 'tilemap' submodule.

Properties


NameDescriptionType
first_gidFirst global tile id (GID) in this tileset.int
last_gidLast global tile id (GID) in this tileset.int
nameTileset name.str
tile_sizeSize of tiles in pixels.Vec2
spacingPixel spacing between tiles in the source image.int
marginPixel margin around the source image.int
tile_countTotal number of tiles in the tileset.int
columnsNumber of tile columns in the source image.int
tile_offsetPer-tile offset applied when rendering.Vec2
terrainsTerrainList of terrain definitions.TileSet.TerrainList
tilesTileSetTileList of tile metadata entries.TileSet.TileSetTileList
textureSource texture for the tileset.Texture

Methods


Has Tile

has_tile(id: int) bool

Check 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.

Get Tile

get_tile(id: int) TileSet.Tile

Retrieve tile metadata for a given id.

Args

  • id : Global tile id (GID).

Returns

Tile : The tile metadata, or None if not found.