API reference

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

C

classMapWorld

@codexo/exojs-tilemap / tilemap / stable

A format-neutral description of how levels are laid out in a world. A `MapWorld` holds metadata only - no tiles, no textures, no runtime maps. It is what a game reads to decide which levels it needs; loading them is import('./MapWorldRuntime').MapWorldRuntime's job. Adapters build one from their source document (`@codexo/exojs-ldtk` does so from a `.ldtk` project). A format with no world concept of its own - Tiled, today - can be described by constructing one directly from whatever placement data the game keeps.

3
props
4
methods
0
events
Import
import { MapWorld } from '@codexo/exojs-tilemap'

A format-neutral description of how levels are laid out in a world.

A `MapWorld` holds metadata only - no tiles, no textures, no runtime maps. It is what a game reads to decide which levels it needs; loading them is import('./MapWorldRuntime').MapWorldRuntime's job.

Adapters build one from their source document (`@codexo/exojs-ldtk` does so from a `.ldtk` project). A format with no world concept of its own - Tiled, today - can be described by constructing one directly from whatever placement data the game keeps.

Constructors1
Methods4
The level with this MapLevel.id, or undefined. Constant time.
The first level in document order whose MapLevel.name matches, or undefined. Constant time. Names are not unique by contract.
Every level whose bounds intersect bounds, in document order. Edge contact alone does not count as an intersection, so two levels laid out side by side are not reported for a query that only touches the seam. Linear in the number of levels - intended for a per-camera-move query over a world of hundreds of levels, not for a per-frame query over thousands.
The levels id declares as adjacent, resolved to their metadata and in the order the source format declared them. A neighbour naming a level this world does not contain is skipped - LDtk can reference across worlds of a multi-world project, and each of those worlds is its own MapWorld. Returns an empty array for an unknown id.
Properties3
name: string
World name; empty when the source format does not name it.
Union of every level's bounds, or a zero rectangle for an empty world. Computed once and cached - a MapWorld is immutable.
Source