Pathfinding

PhaserPathfinding. Pathfinding

The Pathfinding class is used to find a path between 2 points in a grid NOTE: If you want to change the grid after creating the Pathfinding object you need to create a new one as the grid is cloned internally

Constructor

new Pathfinding(grid)

Parameters:
Name Type Description
grid Grid
Source:

Methods

findPathBetweenPx(start, target, config) → {Array.<PathNode>}

The 2 vectors must point to the position in pixels

Parameters:
Name Type Description
start Phaser.Math.Vector2

The start position in pixels

target Phaser.Math.Vector2

The target position in tile unit

config PathfindingConfig

Extra parameters to configure the pathfinder

Source:

findPathBetweenTl(start, target, config) → {Array.<PathNode>}

The 2 vectors must point to the position in tile unit not in px

Parameters:
Name Type Description
start Phaser.Math.Vector2

The start position in tile unit

target Phaser.Math.Vector2

The target position in tile unit

config PathfindingConfig

Extra parameters to configure the pathfinder

Source: