LoadedTileset class

A loaded tileset with texture and metadata.

Contains everything needed to render and query tiles from this tileset.

Constructors

LoadedTileset({required String source, required String name, required int firstGid, required int tileWidth, required int tileHeight, required int columns, required int tileCount, required TextureAtlas atlas, int spacing = 0, int margin = 0, Map<int, TiledProperties> tileProperties = const {}, Map<int, TileAnimation> animations = const {}, Map<int, List<CollisionShape>> collisionShapes = const {}})
const

Properties

animations → Map<int, TileAnimation>
Tile animations (local ID -> animation).
final
atlas → TextureAtlas
The texture atlas containing the tileset image.
final
collisionShapes → Map<int, List<CollisionShape>>
Collision shapes per tile (local ID -> shapes).
final
columns → int
Number of columns in the tileset image.
final
firstGid → int
First GID for this tileset in the map.
final
hashCode → int
The hash code for this object.
no setterinherited
margin → int
Margin around the tileset image in pixels.
final
name → String
Tileset name from Tiled.
final
rows → int
Number of rows in the tileset.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
source → String
Source path of the tileset (TSX file or embedded).
final
spacing → int
Spacing between tiles in pixels.
final
tileCount → int
Total number of tiles in the tileset.
final
tileHeight → int
Tile height in pixels.
final
tileProperties → Map<int, TiledProperties>
Tile-specific properties (local ID -> properties).
final
tileWidth → int
Tile width in pixels.
final

Methods

containsTile(int localId) → bool
Checks if a local ID is valid for this tileset.
getAnimation(int localId) → TileAnimation?
Gets animation for a tile, or null if not animated.
getCollisionShapes(int localId) → List<CollisionShape>
Gets collision shapes for a tile, or empty list if none defined.
getProperties(int localId) → TiledProperties?
Gets properties for a tile, or null if none defined.
getTileRect(int localId) → Rect
Gets the source rectangle for a local tile ID.
gidToLocalId(int gid) → int?
Converts a global tile ID to a local tile ID.
hasAnimation(int localId) → bool
Returns true if a tile has an animation.
hasCollision(int localId) → bool
Returns true if a tile has collision shapes.
hasProperties(int localId) → bool
Returns true if a tile has custom properties.
localIdToGid(int localId) → int
Converts a local tile ID to a global tile ID.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited