LdtkData

Entityceramic.LdtkData (Class)

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.

See: https://ldtk.io/ for more information about LDtk

Instance Members

ldtk
version: String

File format version


ldtk
iid: String

Unique project identifier


ldtk
bgColor: Color

Project background color


A structure containing all the definitions of this project


ldtk
externalLevels: Bool

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.


ldtk
worlds: Array<LdtkWorld>

All worlds of this LDtk project


ldtk
asset: TilemapAsset

The related asset (if any)


ldtk
destroy(): Void

ldtk
world(identifier: String): LdtkWorld

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

ldtk
worldByIid(iid: String): LdtkWorld

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

ldtk
tocEntry(identifier: String): LdtkTocEntry
Name Type
identifier String
Returns
LdtkTocEntry

ldtk
findLayerDef(identifier: String): LdtkLayerDefinition
Name Type
identifier String
Returns
LdtkLayerDefinition

ldtk
findTilesetDef(identifier: String): LdtkTilesetDefinition
Name Type
identifier String
Returns
LdtkTilesetDefinition

ldtk
findEntityDef(identifier: String): LdtkEntityDefinition
Name Type
identifier String
Returns
LdtkEntityDefinition

ldtk
new(?json: haxe.DynamicAccess<Dynamic>, ?loadExternalLevelData: Function, ?loadLevelCeramicTilemap: Function): Void

Creates 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

Private Members

ldtk
loadExternalLevelData(relPath: String, callback: Function): Void

Used to load external level data

Name Type
relPath String
callback Function

ldtk
loadLevelCeramicTilemap(level: LdtkLevel): Void

When loading external levels, we also need a funtion to load the Ceramic tilemap from it. This is it.

Name Type
level LdtkLevel

ldtk
toString(): String
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()