pathfinding.findPath

Section: Pathfinding (A*)

What it does

pathfinding.findPath looks up Path on a pathfinding object. It takes fromX, fromZ, toX and toZ, and answers [{x, z}, ...]|null.

Signature

pathfinding.findPath(fromX, fromZ, toX, toZ) → [{x, z}, ...]|null

Arguments

  • fromX
  • fromZ
  • toX
  • toZ

Example · generated

function start() {  const result = pathfinding.findPath(1, 1, 1, 1);}

pathfinding.findPath is called with values of the shape its signature asks for. The code sits in start(), which the engine calls once, when the entity spawns.

4 members in pathfinding