API reference

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

C

classLdtkProject

@codexo/exojs-ldtk / ldtk / stable

A loaded LDtk project, prepared for streaming: world layout and tileset atlases are resident, level payloads are not. This is the entry point for a game that loads levels as it needs them. Read worlds to decide what to load, then drive a MapWorldRuntime from createRuntime to load and unload individual levels, each with its own asset scope. What is eager, and why: - the `.ldtk` document itself, because the world layout is what the game navigates by; - every tileset atlas. This is a prefetch policy, not a technical requirement, and it is bounded: LDtk declares tilesets once per project (`defs.tilesets`), never per level, so the count does not grow with the number of levels. Paying for them once keeps a level load off the network entirely for a non-externalized project, and off the *image* network for an externalized one. The atlases are claimed by this asset's own scope, so their residency is tied to how long the `ldtkProject` asset is held - not to a MapWorldRuntime. Releasing the asset releases them; destroying a runtime does not. What is lazy: - external `.ldtkl` level payloads - fetched when the level loads, claimed by that level's scope, released when it unloads; - the conversion of a level into a runtime `TileMap`; - anything the level's import('@codexo/exojs-tilemap').MapObjectSpawner creates. Load the whole project at once with the `ldtkMap` asset type instead (import('./LdtkMap').LdtkMap) when a game is small enough not to need any of this.

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

A loaded LDtk project, prepared for streaming: world layout and tileset atlases are resident, level payloads are not.

This is the entry point for a game that loads levels as it needs them. Read worlds to decide what to load, then drive a MapWorldRuntime from createRuntime to load and unload individual levels, each with its own asset scope.

What is eager, and why:

- the `.ldtk` document itself, because the world layout is what the game navigates by; - every tileset atlas. This is a prefetch policy, not a technical requirement, and it is bounded: LDtk declares tilesets once per project (`defs.tilesets`), never per level, so the count does not grow with the number of levels. Paying for them once keeps a level load off the network entirely for a non-externalized project, and off the *image* network for an externalized one.

The atlases are claimed by this asset's own scope, so their residency is tied to how long the `ldtkProject` asset is held - not to a MapWorldRuntime. Releasing the asset releases them; destroying a runtime does not.

What is lazy:

- external `.ldtkl` level payloads - fetched when the level loads, claimed by that level's scope, released when it unloads; - the conversion of a level into a runtime `TileMap`; - anything the level's import('@codexo/exojs-tilemap').MapObjectSpawner creates.

Load the whole project at once with the `ldtkMap` asset type instead (import('./LdtkMap').LdtkMap) when a game is small enough not to need any of this.

Methods2
Create the live runtime that loads and unloads this project's levels. The runtime is a separate lifetime from the project: destroying it unloads every level it holds and leaves the project - document, world layout and tilesets - intact, ready for a new runtime.
Properties5
The raw parsed LDtk document. Externalized levels still carry layerInstances: null.
source: string
Resolved URL this project was loaded from.
The project's only world. For a multi-world project this is the first in document order; read worlds to reach the others.
Source