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)

Parameters:
NameTypeDescription
xnumber

Tile x

ynumber

Tile y

Members

cost

Properties
TypeDescription
number

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

f

Properties
TypeDescription
number

A* F-score: G + heuristic

g

Properties
TypeDescription
number

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

isClosed

Properties
TypeDescription
boolean

In the A* closed list

isOpen

Properties
TypeDescription
boolean

In the A* open list

parent

Properties
TypeDescription
PathFinderNode | null

Parent for path reconstruction

pos

Properties
TypeDescription
Vector2

Tile coords (integer)

posWorld

Properties
TypeDescription
Vector2

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

walkable

Properties
TypeDescription
boolean

True if this cell is passable (cleared each findPath call)

Methods

isClear()

True if walkable and not blocked by cost.

reset()

Reset per-search state (called at the start of buildNodeData).