Skip to content

1681-engine / index / findPath

Function: findPath() ​

ts
function findPath(
   g, 
   from, 
   to, 
   options?
): TilePoint[] | null;

Defined in: src/nav/findPath.ts:40

A* over the grid: the tiles from from to the goal, both included, or null when there is no way through. A start on a wall is moved to the nearest open tile. The path is the cheapest by cost, but among equally cheap ones it is whichever the heap settled on — often a staircase; straightenPath irons that out.

Parameters ​

ParameterType
gNavGrid
fromTilePoint
toNavGoal
optionsFindPathOptions

Returns ​

TilePoint[] | null

Released under the MIT License.