Skip to content

LevelComp

Defined in: packages/threeplay/src/plugins/level/types.ts:24

Fields of the level object returned by addLevel(). Tiles are its children, laid on the XZ plane: column → +X, row → +Z.

optional add(this): void

Defined in: packages/threeplay/src/core/types.ts:63

Called when the object enters the scene (or when used on a live object).

GameObj

void

Comp.add


charAt(col, row): string

Defined in: packages/threeplay/src/plugins/level/types.ts:39

The map character at a grid cell, as written in the map (" " outside).

number

number

string


optional destroy(this): void

Defined in: packages/threeplay/src/core/types.ts:69

Called when the object is destroyed or the component removed.

GameObj

void

Comp.destroy


optional fixedUpdate(this): void

Defined in: packages/threeplay/src/core/types.ts:67

Called at the fixed physics rate (50 Hz by default).

GameObj

void

Comp.fixedUpdate


getAt(col, row): GameObj[]

Defined in: packages/threeplay/src/plugins/level/types.ts:37

Tile objects spawned at a grid cell (destroyed ones drop out; moved ones stay in their spawn cell).

number

number

GameObj[]


optional inspect(this): string | null | undefined

Defined in: packages/threeplay/src/core/types.ts:71

Short status line shown by the debug inspector.

GameObj

string | null | undefined

Comp.inspect


spawn(what, col, row): GameObj | null

Defined in: packages/threeplay/src/plugins/level/types.ts:44

Adds a tile at a grid cell, from a map character (built with tiles) or a component list. Returns null when the character builds nothing.

string | CompList

number

number

GameObj | null


tileToWorld(col, row): Vector3

Defined in: packages/threeplay/src/plugins/level/types.ts:33

Center of a tile in world space (follows the level object if it moves).

number

number

Vector3


optional update(this): void

Defined in: packages/threeplay/src/core/types.ts:65

Called once per frame.

GameObj

void

Comp.update


worldToTile(p): object

Defined in: packages/threeplay/src/plugins/level/types.ts:35

Tile under a world point (may be outside the map).

number

number

object

col: number

row: number

optional conflicts?: string[]

Defined in: packages/threeplay/src/core/types.ts:61

Ids of components that can’t be on the same object (checked both ways).

Comp.conflicts


id: "level"

Defined in: packages/threeplay/src/plugins/level/types.ts:25

Unique name. Two components with the same id replace each other.

Comp.id


readonly numCols: number

Defined in: packages/threeplay/src/plugins/level/types.ts:27

Width of the map in tiles (the longest row).


readonly numRows: number

Defined in: packages/threeplay/src/plugins/level/types.ts:29

Height of the map in tiles.


optional require?: string[]

Defined in: packages/threeplay/src/core/types.ts:59

Ids of components that must be present on the object.

Comp.require


readonly tileSize: number

Defined in: packages/threeplay/src/plugins/level/types.ts:31

Size of a tile on X and Z.