LittleJS 1.28.0

PathFinding

PathFinderNode

A single grid cell tracked by the pathfinder. Allocated once per cell at PathFinder construction; reset (not reallocated) at the start of every findPath call.

Constructor

new PathFinderNode(x, y)pathFinder.js:27

Make the node of a grid cell, as PathFinder does for each

x number

Tile x

y number

Tile y

Members

Methods

Members

cost : numberpathFinder.js:41

Extra cost added to A* G-score for stepping on this cell

A* F-score: G + heuristic

A* G-score: actual cost from start to this node

A* heuristic: the estimated cost left to the goal, breaks ties between equal F

heapIndex : numberpathFinder.js:56

Where it is in the A* open list's heap, while open

isClosed : booleanpathFinder.js:54

In the A* closed list

isOpen : booleanpathFinder.js:52

In the A* open list

Parent for path reconstruction

Tile coords (integer)

World-space center of this tile (set by buildNodeData)

walkable : booleanpathFinder.js:39

True if this cell is passable (set by buildNodeData)

Methods

isClear() → booleanpathFinder.js:72

True if walkable and not blocked by cost

Reset per-search state and walkability (called by buildNodeData)

resetSearch()pathFinder.js:60

Clear what a search left on this node, keeping walkable and cost