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.
Extends
Section titled “Extends”Methods
Section titled “Methods”add()?
Section titled “add()?”
optionaladd(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).
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”charAt()
Section titled “charAt()”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).
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”string
destroy()?
Section titled “destroy()?”
optionaldestroy(this):void
Defined in: packages/threeplay/src/core/types.ts:69
Called when the object is destroyed or the component removed.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”fixedUpdate()?
Section titled “fixedUpdate()?”
optionalfixedUpdate(this):void
Defined in: packages/threeplay/src/core/types.ts:67
Called at the fixed physics rate (50 Hz by default).
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”getAt()
Section titled “getAt()”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).
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”GameObj[]
inspect()?
Section titled “inspect()?”
optionalinspect(this):string|null|undefined
Defined in: packages/threeplay/src/core/types.ts:71
Short status line shown by the debug inspector.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”string | null | undefined
Inherited from
Section titled “Inherited from”spawn()
Section titled “spawn()”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.
Parameters
Section titled “Parameters”string | CompList
number
number
Returns
Section titled “Returns”GameObj | null
tileToWorld()
Section titled “tileToWorld()”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).
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”Vector3
update()?
Section titled “update()?”
optionalupdate(this):void
Defined in: packages/threeplay/src/core/types.ts:65
Called once per frame.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”worldToTile()
Section titled “worldToTile()”worldToTile(
p):object
Defined in: packages/threeplay/src/plugins/level/types.ts:35
Tile under a world point (may be outside the map).
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”object
col:
number
row:
number
Properties
Section titled “Properties”conflicts?
Section titled “conflicts?”
optionalconflicts?:string[]
Defined in: packages/threeplay/src/core/types.ts:61
Ids of components that can’t be on the same object (checked both ways).
Inherited from
Section titled “Inherited from”id:
"level"
Defined in: packages/threeplay/src/plugins/level/types.ts:25
Unique name. Two components with the same id replace each other.
Overrides
Section titled “Overrides”numCols
Section titled “numCols”
readonlynumCols:number
Defined in: packages/threeplay/src/plugins/level/types.ts:27
Width of the map in tiles (the longest row).
numRows
Section titled “numRows”
readonlynumRows:number
Defined in: packages/threeplay/src/plugins/level/types.ts:29
Height of the map in tiles.
require?
Section titled “require?”
optionalrequire?:string[]
Defined in: packages/threeplay/src/core/types.ts:59
Ids of components that must be present on the object.
Inherited from
Section titled “Inherited from”tileSize
Section titled “tileSize”
readonlytileSize:number
Defined in: packages/threeplay/src/plugins/level/types.ts:31
Size of a tile on X and Z.