Array Enum names defined for this World.
A map of Enum ids to Enums.
Array Enums defined for this World.
Array Levels Ids defined for this World.
A map of Level ids to Levels.
Array Levels defined for this World.
Array Tilesets Ids defined for this World.
A map of Tileset ids to Tilesets.
Array Tilesets defined for this World.
Background color (RGB hex string)
True if this world was saved with separate level files
option.
The world layout
Possible values: "Free", "GridVania", "LinearHorizontal", "LinearVertical"
Used for fetching external levels
Find an enum by its uid
.
Find a level by its uid
.
Find a tileset by its path
.
Find a tileset by its uid
.
Load and parse external level identifier
.
This allows for dynamically loading individual levels.
If a level is already loaded, it won't be loaded again.
Load and parse all external levels and enums.
If a level is already loaded, it won't be loaded again.
Asynchronously load and parse an LDtk project file
Load the raw JSON without any utilities.
This does the following in Node:
const path = ... ;
import * as fs from "fs";
const world = await new Promise((resolve, reject) => {
fs.readFile(path, { encoding: "utf-8" }, (err, data) => {
if (err) reject(err);
else resolve(JSON.parse(data) as LDtk.World);
});
})
And in the browser:
const path = ... ;
const world = await (await fetch(path)).json() as LDtk.World;
Generated using TypeDoc
Worlds contains various definitions (Enum, Tileset) and are made up of one or more Levels, which utilise these definitions.
Worlds can have different layouts:
Linear
,Free
, orGridVania
.Linear worlds are organized as a linear sequence of levels, either horizontal or vertical.
Free worlds are not organized, all levels appear freely in 2D space.
GridVania worlds are organized into a uniform 2D grid, where each level can take up one or more grid cells.
Visit https://ldtk.io/docs/general/world/ for more information.