A level component.
groupComponent Types
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.
returnsThe spawned game object, or null if the obj hasn't components.
spawn<T>(sym: CompList , x: number , y: number ): GameObj | null
Total width of level in pixels.
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.
returnsA 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.
returnsA list of traverse points in pixel positions.