LdtkLevel
Represents a single level in an LDtk world.
Contains all the layer instances, entities, and properties for one game level. Levels can reference external data files in multi-file projects.
Each level has:
- Position in world coordinates
- Background settings
- Layer instances with tiles and entities
- Custom field values
Instance Members
The LdtkWorld
object this level belong to
The Ceramic tilemap generated from this level
Background color of the level
Position informations of the background image, if there is one. (can be null
)
The optional relative path to the level background image. (can be null)
An array listing all other levels touching this one on the world map. Only relevant for world layouts where level spatial positioning is manual (ie. GridVania, Free). For Horizontal and Vertical layouts, this array is always empty.
This value is not null if the project option "Save levels separately" is enabled. In this case, this relative path points to the level Json file.
An array containing this level custom field values.
User defined unique identifier
Unique instance identifier
An array containing all Layer instances. IMPORTANT: if the project option "Save levels separately" is enabled, this field will be null
.
This array is sorted in display order: the 1st layer is the top-most and the last is behind.
Width of the level in pixels
Height of the level in pixels
Unique Int identifier
Index that represents the "depth" of the level in the world. Default is 0, greater means "above", lower means "below". This value is mostly used for display only and is intended to make stacking of levels easier to manage.
World X coordinate in pixels. Only relevant for world layouts where level spatial positioning is manual (ie. GridVania, Free). For Horizontal and Vertical layouts, the value is always -1 here.
World Y coordinate in pixels. Only relevant for world layouts where level spatial positioning is manual (ie. GridVania, Free). For Horizontal and Vertical layouts, the value is always -1 here.
Name | Type |
---|---|
done |
Function |
Name | Type |
---|---|
identifier |
String |
Returns |
---|
LdtkLayerInstance |
Name | Type |
---|---|
identifier |
String |
Returns |
---|
LdtkFieldInstance |
Walk through every entity instance in the level.
Optionally filter by identifier
. The callback
will be
called for each matching entity instance.
Name | Type |
---|---|
identifier |
String |
callback |
Function |
Create visuals for every entity instance in the level.
Optionally filter by identifier
. If provided, the createVisual
callback
will be called for every entity, and this callback can either return a Visual
instance or null
.
If a visual is created, it will be added at the correct depth
in the tilemap
object, inside the correct layer
.
If createVisual
is not provided, this method will create instances of LdtkVisual
,
which are built-in visuals that will display entities that are renderable.
Name | Type | Default |
---|---|---|
tilemap |
Tilemap | |
identifier |
String | (optional) |
createVisual |
Function | (optional) |
Returns |
---|
String |
Name | Type | Default |
---|---|---|
ldtkData |
LdtkData | (optional) |
world |
LdtkWorld | (optional) |
json |
haxe.DynamicAccess<Dynamic> | (optional) |