TilemapTile
ceramic.TilemapTile (Abstract)
Represents a single tile in a tilemap, storing both the tile ID and transformation flags.
TilemapTile is an abstract type over Int that encodes multiple pieces of information:
- The global tile ID (GID) referencing a tile in a tileset
- Horizontal flip flag
- Vertical flip flag
- Diagonal flip flag (for 90° rotations)
This encoding follows the Tiled Map Editor (TMX) format specification, where the upper 3 bits store transformation flags and the lower 29 bits store the GID.
Bit Layout
Bit 31: Horizontal flip
Bit 30: Vertical flip
Bit 29: Diagonal flip (swap X/Y axis)
Bits 0-28: Global tile ID (GID)
Usage Example
// Create a tile with GID 42
var tile:TilemapTile = 42;
// Apply transformations
tile.horizontalFlip = true;
tile.verticalFlip = true;
// Rotate the tile
tile.rotateRight(); // 90° clockwise
// Get the actual tile ID
var gid = tile.gid; // Gets ID without flags
See: TilemapLayerData, TilemapQuad
Type Conversions
From:
[Int](/api-docs/clay-native/Int/)
To:
[Int](/api-docs/clay-native/Int/)