LdtkLayerInstance

ceramic.LdtkLayerInstance (Class)

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

ldtk
ceramicLayer: TilemapLayerData

The Ceramic layer generated from this level


ldtk
level: LdtkLevel

The LDtk level this layer instance belongs to


The related layer definition


ldtk
opacity: Float

Layer opacity as Float [0-1]


ldtk
cWid: Int

Grid-based width


ldtk
cHei: Int

Grid-based height


ldtk
pxTotalOffsetX: Int

Total layer X pixel offset, including both instance and definition offsets.


ldtk
pxTotalOffsetY: Int

Total layer Y pixel offset, including both instance and definition offsets.


The corresponding Tileset definition, if any.


ldtk
autoLayerTiles: Array<Int>

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].


ldtk
entityInstances: Array<LdtkEntityInstance>

Entity instances (only on Entity layers)


ldtk
gridTiles: Array<Int>

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].


ldtk
iid: String

Unique layer instance identifier


ldtk
intGrid: Array<Int>

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)


ldtk
levelId: Int

Reference to the UID of the level containing this layer instance


ldtk
pxOffsetX: Int

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)


ldtk
pxOffsetY: Int

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)


ldtk
visible: Bool

Layer instance visibility


ldtk
optionalRules: Array<Int>

An Array containing the UIDs of optional rules that were enabled in this specific layer instance.


ldtk
seed: Int

Random seed used for Auto-Layers rendering


ldtk
toString(): String
Returns
String

ldtk
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)