LdtkLayerInstance
An instance of a layer in a level.
Contains the actual tile data, entity instances, and int grid values for this specific layer in this specific level.
Instance Members
The Ceramic layer generated from this level
The LDtk level this layer instance belongs to
The related layer definition
Layer opacity as Float [0-1]
Grid-based width
Grid-based height
Total layer X pixel offset, including both instance and definition offsets.
Total layer Y pixel offset, including both instance and definition offsets.
The corresponding Tileset definition, if any.
An array containing all tile info generated by Auto-layer rules. The array is already sorted in display order (ie. 1st tile is beneath 2nd, which is beneath 3rd etc.). Note: if multiple tiles are stacked in the same cell as the result of different rules, all tiles behind opaque ones will be discarded. One tile is stored into 7 int values:
[0] The Tile ID in the corresponding tileset.
[1] "Flip bits", a 2-bits integer to represent the mirror transformations of the tile.
- Bit 0 = X flip
- Bit 1 = Y flip
Examples: f=0 (no flip), f=1 (X flip only), f=2 (Y flip only), f=3 (both flips)
[2] Pixel X coordinate of the tile in the layer. Don't forget optional layer offsets, if they exist!
[3] Pixel Y coordinate of the tile in the layer. Don't forget optional layer offsets, if they exist!
[4] Pixel X coordinate of the tile in the tileset.
[5] Pixel Y coordinate of the tile in the tileset.
[6] Pixel alpha [0-4096].
Entity instances (only on Entity layers)
Tile instances (only on Tile layers)
One tile is stored into 7 int values:
[0] The Tile ID in the corresponding tileset.
[1] "Flip bits", a 2-bits integer to represent the mirror transformations of the tile.
- Bit 0 = X flip
- Bit 1 = Y flip
Examples: f=0 (no flip), f=1 (X flip only), f=2 (Y flip only), f=3 (both flips)
[2] Pixel X coordinate of the tile in the layer. Don't forget optional layer offsets, if they exist!
[3] Pixel Y coordinate of the tile in the layer. Don't forget optional layer offsets, if they exist!
[4] Pixel X coordinate of the tile in the tileset.
[5] Pixel Y coordinate of the tile in the tileset.
[6] Pixel alpha [0-4096].
Unique layer instance identifier
A list of all values in the IntGrid layer Order is from left to right, and top to bottom (ie. first row from left to right, followed by second row, etc). 0 means "empty cell" and IntGrid values start at 1. The array size is cWid x cHei cells. (only IntGrid layers)
Reference to the UID of the level containing this layer instance
X offset in pixels to render this layer, usually 0
(IMPORTANT: this should be added to the LayerDef optional offset, so you should probably prefer using pxTotalOffsetX
which contains the total offset value)
Y offset in pixels to render this layer, usually 0
(IMPORTANT: this should be added to the LayerDef optional offset, so you should probably prefer using pxTotalOffsetY
which contains the total offset value)
Layer instance visibility
An Array containing the UIDs of optional rules that were enabled in this specific layer instance.
Random seed used for Auto-Layers rendering
Returns |
---|
String |
new(?level: LdtkLevel, ?ldtkData: LdtkData, ?ldtkWorld: LdtkWorld, ?json: haxe.DynamicAccess<Dynamic>): Void
Name | Type | Default |
---|---|---|
level |
LdtkLevel | (optional) |
ldtkData |
LdtkData | (optional) |
ldtkWorld |
LdtkWorld | (optional) |
json |
haxe.DynamicAccess<Dynamic> | (optional) |