Tileset class
Below is Tiled's documentation about how this structure is represented on XML files:
<tileset>
- firstgid: The first global tile ID of this tileset (this global ID maps to the first tile in this tileset).
- source: If this tileset is stored in an external TSX (Tile Set XML) file,
this attribute refers to that file. That TSX file has the same structure
as the
<tileset>
element described here. (There is the firstgid attribute missing and this source attribute is also not there. These two attributes are kept in the TMX map, since they are map specific.) - name: The name of this tileset.
- tilewidth: The (maximum) width of the tiles in this tileset.
- tileheight: The (maximum) height of the tiles in this tileset.
- spacing: The spacing in pixels between the tiles in this tileset (applies to the tileset image, defaults to 0)
- margin: The margin around the tiles in this tileset (applies to the tileset image, defaults to 0)
- tilecount: The number of tiles in this tileset (since 0.13)
- columns: The number of tile columns in the tileset. For image collection tilesets it is editable and is used when displaying the tileset. (since 0.15)
- objectalignment: Controls the alignment for tile objects. Valid values are unspecified, topleft, top, topright, left, center, right, bottomleft, bottom and bottomright. The default value is unspecified, for compatibility reasons. When unspecified, tile objects use bottomleft in orthogonal mode and bottom in isometric mode. (since 1.4)
If there are multiple <tileset>
elements, they are in ascending order of
their firstgid attribute. The first tileset always has a firstgid value of
- Since Tiled 0.15, image collection tilesets do not necessarily number their tiles consecutively since gaps can occur when removing tiles.
Image collection tilesets have no <image>
tag. Instead, each tile has an
<image>
tag.
Can contain at most one: <image>
, <tileoffset>
, <grid>
(since 1.0),
<properties>
, <terraintypes>
, <wangsets>
(since 1.1),
<transformations>
(since 1.5)
Can contain any number: <tile>
Constructors
-
Tileset.new({int? firstGid, String? source, String? name, int? tileWidth, int? tileHeight, int spacing = 0, int margin = 0, int? tileCount, int? columns, ObjectAlignment objectAlignment = ObjectAlignment.unspecified, List<
Tile> tiles = const [], TiledImage? image, TileOffset? tileOffset, Grid? grid, CustomProperties properties = CustomProperties.empty, List<Terrain> terrains = const [], List<WangSet> wangSets = const [], String version = '1.0', String? tiledVersion, String? backgroundColor, String? transparentColor, TilesetType type = TilesetType.tileset}) - Tileset.parse(Parser parser, {TsxProvider? tsx})
-
factory
Properties
- backgroundColor ↔ String?
-
getter/setter pair
- columns ↔ int?
-
getter/setter pair
- firstGid ↔ int?
-
getter/setter pair
- grid ↔ Grid?
-
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- image ↔ TiledImage?
-
getter/setter pair
- margin ↔ int
-
getter/setter pair
- name ↔ String?
-
getter/setter pair
- objectAlignment ↔ ObjectAlignment
-
getter/setter pair
- properties ↔ CustomProperties
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- source ↔ String?
-
getter/setter pair
- spacing ↔ int
-
getter/setter pair
-
terrains
↔ List<
Terrain> -
getter/setter pair
- tileCount ↔ int?
-
getter/setter pair
- tiledVersion ↔ String?
-
getter/setter pair
- tileHeight ↔ int?
-
getter/setter pair
- tileOffset ↔ TileOffset?
-
getter/setter pair
-
tiles
↔ List<
Tile> -
getter/setter pair
- tileWidth ↔ int?
-
getter/setter pair
- transparentColor ↔ String?
-
getter/setter pair
- type ↔ TilesetType
-
getter/setter pair
- version ↔ String
-
getter/setter pair
-
wangSets
↔ List<
WangSet> -
getter/setter pair
Methods
-
computeDrawRect(
Tile tile) → Rectangle< num> -
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