LdtkData
Root class representing an LDtk project data structure.
This is the main entry point for working with LDtk level data in Ceramic. It contains all the project definitions, worlds, and levels from an LDtk file.
The data structure is optimized for performance on static targets and provides easy access to all LDtk entities, layers, and tilesets.
Instance Members
File format version
Unique project identifier
Project background color
A structure containing all the definitions of this project
If true, one file will be saved for the project (incl. all its definitions) and one file in a sub-folder for each level.
All instances of entities that have their exportToToc flag enabled are listed by def identifier here.
All worlds of this LDtk project
The related asset (if any)
Called by the LDtk parser once it refreshed the pixel data of a tileset after a texture hot reload, when that data actually changed.
Gets a world by its identifier.
| Name | Type | Description |
|---|---|---|
identifier |
String | The world identifier to search for |
| Returns | Description |
|---|---|
| LdtkWorld | The matching LdtkWorld, or null if not found |
Gets a world by its unique instance identifier (IID).
| Name | Type | Description |
|---|---|---|
iid |
String | The world IID to search for |
| Returns | Description |
|---|---|
| LdtkWorld | The matching LdtkWorld, or null if not found |
| Name | Type |
|---|---|
identifier |
String |
| Returns |
|---|
| LdtkTocEntry |
| Name | Type |
|---|---|
identifier |
String |
| Returns |
|---|
| LdtkLayerDefinition |
| Name | Type |
|---|---|
identifier |
String |
| Returns |
|---|
| LdtkTilesetDefinition |
| Name | Type |
|---|---|
identifier |
String |
| Returns |
|---|
| LdtkEntityDefinition |
Find a layer instance by its iid across all worlds and levels
| Name | Type | Description |
|---|---|---|
iid |
String | The unique instance identifier of the layer |
| Returns | Description |
|---|---|
| LdtkLayerInstance | The layer instance if found, null otherwise |
new(?json: haxe.DynamicAccess<Dynamic>, ?loadExternalLevelData: Function, ?loadLevelCeramicTilemap: Function): VoidCreates a new LdtkData instance from JSON data.
| Name | Type | Default | Description |
|---|---|---|---|
json |
haxe.DynamicAccess<Dynamic> | (optional) | The parsed LDtk project JSON data |
loadExternalLevelData |
Function | (optional) | Optional callback to load external level data when using multi-file projects |
loadLevelCeramicTilemap |
Function | (optional) | Optional callback to load Ceramic tilemap for a level |
Events
Emitted when the per-tile pixel data of a tileset (empty / opaque tiles) changed after its texture was hot reloaded, so that already converted levels can be rebuilt.
onTilesetsPixelDataChange(owner, handler) onceTilesetsPixelDataChange(owner, handler) offTilesetsPixelDataChange(?handler) listensTilesetsPixelDataChange()Private Members
Emitted when the per-tile pixel data of a tileset (empty / opaque tiles) changed after its texture was hot reloaded, so that already converted levels can be rebuilt.
Used to load external level data
| Name | Type |
|---|---|
relPath |
String |
callback |
Function |
When loading external levels, we also need a funtion to load the Ceramic tilemap from it. This is it.
| Name | Type |
|---|---|
level |
LdtkLevel |
| Returns |
|---|
| String |
Metadata
| Name | Parameters |
|---|---|
:build |
ceramic.macros.EntityMacro.buildForCompletion() |
:autoBuild |
ceramic.macros.EntityMacro.buildForCompletion() |
:build |
tracker.macros.EventsMacro.build() |
:autoBuild |
tracker.macros.EventsMacro.build() |