tilemap.TileSet
pykraken.tilemap.TileSet TileSet represents a collection of tiles and associated metadata.
More about tilemap.TileSet
Attributes
- first_gid (
int) — First global tile ID in the tileset. - last_gid (
int) — Last global tile ID in the tileset. - name (
str) — Name of the tileset. - tile_size (
Vec2) — Size of individual tiles. - spacing (
int) — Pixel spacing between tiles in the source image. - margin (
int) — Margin in the source image. - tile_count (
int) — Total number of tiles. - columns (
int) — Number of tile columns in the source image. - tile_offset (
Vec2) — Offset applied to tiles. - terrains (
TerrainList) — List of terrain definitions. - tiles (
TileSetTileList) — List of tile metadata. - texture (
Texture) — Source texture for this tileset.
Methods
- has_tile — Check whether a global tile id belongs to this tileset.
- get_tile — Retrieve tile metadata for a given id.
At a glance
15 membersReference
PYTHON APIConstructor
methodtilemap.TileSet(/, *args, **kwargs)Initialize self. See help(type(self)) for accurate signature.
columns
propertycolumns: intNumber of tile columns in the source image.
first_gid
propertyfirst_gid: intFirst global tile id (GID) in this tileset.
last_gid
propertylast_gid: intLast global tile id (GID) in this tileset.
margin
propertymargin: intPixel margin around the source image.
name
propertyname: strTileset name.
spacing
propertyspacing: intPixel spacing between tiles in the source image.
terrains
propertyterrains: tilemap.TileSet.TerrainListTerrainList of terrain definitions.
texture
propertytexture: TextureSource texture for the tileset.
tile_count
propertytile_count: intTotal number of tiles in the tileset.
tile_offset
propertytile_offset: Vec2Per-tile offset applied when rendering.
tile_size
propertytile_size: Vec2Size of tiles in pixels.
tiles
propertyTileSetTileList of tile metadata entries.
get_tile
methodget_tile(self, id: int) -> tilemap.TileSet.TileRetrieve tile metadata for a given id.
Args
- id (
int) — Global tile id (GID).
Returns
- Tile — The tile metadata, or None if not found.
has_tile
methodhas_tile(self, id: int) -> boolCheck whether a global tile id belongs to this tileset.
Args
- id (
int) — Global tile id (GID).
Returns
- bool — True if the tileset contains the tile id, False otherwise.