LdtkAutoLayerRuleDefinition

ceramic.LdtkAutoLayerRuleDefinition (Class)

This complex section isn't meant to be used by game devs according to LDtk documentation, but Ceramic auto-tiling rules can be generated from these so they may still be useful for us if we want to edit a map in game while still fully working auto-layer rules from LDtk. The use of this is opt-in. Default map loading is using already resolved tiles.

Instance Members

ldtk
active: Bool

If false, the rule effect isn't applied, and no tiles are generated.


ldtk
breakOnMatch: Bool

When true, the rule will prevent other rules to be applied in the same cell if it matches (true by default).


ldtk
chance: Float

Chances for this rule to be applied (0 to 1)


ldtk
checker: LdtkCheckerMode

Checker mode


ldtk
flipX: Bool

If true, allow rule to be matched by flipping its pattern horizontally


ldtk
flipY: Bool

If true, allow rule to be matched by flipping its pattern vertically


ldtk
outOfBoundsValue: Int

Default IntGrid value when checking cells outside of level bounds


ldtk
pattern: Array<Int>

Rule pattern (size x size). Each cell holds its first condition: 0 = ignored, +v = IntGrid value v required, -v = value v forbidden (see patternAlt for extra conditions).


ldtk
patternAlt: Array<Array<Int>>

Extra conditions per pattern cell (same size and order as pattern, same value encoding). Each entry is an empty array when the cell has a single condition. A cell matches if (it has no required value, or the cell value is one of the required values) AND (the cell value is none of the forbidden values). (added in LDtk 1.5.4)


ldtk
perlinActive: Bool

If true, enable Perlin filtering to only apply rule on specific random area


ldtk
perlinOctaves: Float

ldtk
perlinScale: Float

ldtk
perlinSeed: Float

ldtk
pivotX: Float

X pivot of a tile stamp (0-1)


ldtk
pivotY: Float

Y pivot of a tile stamp (0-1)


ldtk
size: Int

Pattern width & height. Should only be 1,3,5 or 7.


ldtk
tileIds: Array<Int>

Array of all the tile IDs, flattened from tileRectsIds. Deprecated in LDtk 1.5.0 in favor of tileRectsIds, but still filled for convenience.


ldtk
tileRectsIds: Array<Array<Int>>

Array containing all the possible tile IDs rectangles (picked randomly). Each entry is a list of tile IDs: a single tile in Single tile mode, or a rectangle of tiles in Stamp tile mode. (added in LDtk 1.5.0, replaces tileIds)


ldtk
tileRandomFlipX: Bool

If true, the tile(s) rendered by this rule can be randomly flipped horizontally. This doesn't affect the pattern matching (see flipX for that). The resulting flips are already baked in the autoLayerTiles flip bits. (added in LDtk 1.5.4)


ldtk
tileRandomFlipY: Bool

If true, the tile(s) rendered by this rule can be randomly flipped vertically. This doesn't affect the pattern matching (see flipY for that). The resulting flips are already baked in the autoLayerTiles flip bits. (added in LDtk 1.5.4)


ldtk
tileMode: LdtkTileMode

Defines how tileRectsIds array is used


ldtk
uid: Int

Unique Int identifier


ldtk
xModulo: Int

X cell coord modulo


ldtk
xOffset: Int

X cell start offset


ldtk
yModulo: Int

Y cell coord modulo


ldtk
yOffset: Int

Y cell start offset


This rule as used by the LDtk rule engine (ldtk.rules.RuleEngine), to recompute auto-layer tiles at runtime.


ldtk
toString(): String
Returns
String

ldtk
new(?json: haxe.DynamicAccess<Dynamic>): Void
Name Type Default
json haxe.DynamicAccess<Dynamic> (optional)