API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classLdtkMap

@codexo/exojs-ldtk / ldtk / stable

A parsed LDtk world document: holds the raw JSON data and the converted runtime TileMap for each level. `LdtkMap` is the parsed source model. Each LDtk level is independently convertible to a format-independent `TileMap`; access them via levels (by document order) or by name via getLevelByName. Construction is cheap - the runtime `TileMap[]` is supplied externally (built by import('./ldtkToTileMap').ldtkToTileMap). The map does **not** own tileset textures; those remain in the Loader cache.

5
props
2
methods
0
events
Import
import { LdtkMap } from '@codexo/exojs-ldtk'

A parsed LDtk world document: holds the raw JSON data and the converted runtime TileMap for each level.

`LdtkMap` is the parsed source model. Each LDtk level is independently convertible to a format-independent `TileMap`; access them via levels (by document order) or by name via getLevelByName.

Construction is cheap - the runtime `TileMap[]` is supplied externally (built by import('./ldtkToTileMap').ldtkToTileMap). The map does **not** own tileset textures; those remain in the Loader cache.

Constructors1
Methods2
destroy(): void
Destroy all owned runtime TileMaps. Is idempotent. Does NOT destroy tileset textures (Loader-owned) or any SceneNodes - the application is responsible for those.
Find a level's runtime TileMap by the LDtk level identifier, or undefined when no level with that name exists. Searches across import('./ldtkLevelEntries').getLdtkLevelEntries's flattened level set rather than data.levels directly, so this works for both single-world and multi-world documents - data.levels alone is empty for the latter. The lookup is O(n) in the number of levels.
Properties5
The raw parsed LDtk document.
Runtime TileMaps - one per LDtk level, in document order. The index here corresponds to import('./ldtkLevelEntries').getLdtkLevelEntries(data)[i], not data.levels[i] - the latter is empty for multi-world documents, where levels live under data.worlds[].levels instead. loadLdtkMap fully resolves external .ldtkl levels before conversion, so every entry here is always a fully converted TileMap.
source: string
Resolved URL this map was loaded from.
The document's only world. Convenience for the single-world case; for a multi-world project this is the first world in document order and worlds is what to read instead.
The document's world layout: level placement, bounds and neighbour graph, one MapWorld per LDtk world (exactly one for a single-world project). Built on first access and cached. This is metadata about *where* levels are, independent of the runtime maps in levels. Use it to navigate; use import('./LdtkWorld').LdtkWorld instead when levels should be loaded on demand rather than all at once.
Source