LevelComp:
A level component.
tileWidth(): number
tileHeight(): number
numRows(): number
numColumns(): number
spawn(sym: string, p: Vec2): GameObj | null
Spawn a tile from a symbol defined previously.
spawn(sym: string, x: number, y: number): GameObj | null
spawn<T>(obj: CompList, p: Vec2): GameObj | null
Spawn a tile from a component list.
returns
The spawned game object, or null if the obj hasn't components.
spawn<T>(sym: CompList, x: number, y: number): GameObj | null
levelWidth(): number
Total width of level in pixels.
levelHeight(): number
Total height of level in pixels.
getAt(tilePos: Vec2): GameObj[]
Get all game objects that's currently inside a given tile.
raycast(origin: Vec2, direction: Vec2): RaycastResult
Raycast all game objects on the given path.
tile2Pos(tilePos: Vec2): Vec2
Convert tile position to pixel position.
tile2Pos(x: number, y: number): Vec2
pos2Tile(pos: Vec2): Vec2
Convert pixel position to tile position.
pos2Tile(x: number, y: number): Vec2
getTilePath(from: Vec2, to: Vec2, opts?: PathFindOpt): Vec2[] | null
Find the path to navigate from one tile to another tile.
returns
A list of traverse points in tile positions.
getPath(from: Vec2, to: Vec2, opts?: PathFindOpt): Vec2[] | null
Find the path to navigate from one tile to another tile.
returns
A list of traverse points in pixel positions.