npm i pathfinding.ts
Finders:
- Jump Point - Diagonal Movement
Jump point: 10
const grid = Grid.from([
[50, 55, 60, 65, 70],
[45, 0, 0, 0, 75],
[40, 0, 0, 0, 1], //x4y2
[35, 0, 0, 0, 5],
[30, 25, 20, 15, 10],
]);
grid.findPath(
{ x: 4, y: 2 },
{ x: 4, y: 1 },
{ finder: FinderEnum.JUMP_POINT, maxJumpCost: 10 },
);
[
{ x: 4, y: 2 },
{ x: 4, y: 4 },
{ x: 0, y: 4 },
{ x: 0, y: 0 },
{ x: 4, y: 0 },
{ x: 4, y: 1 },
];
grid.findPath({ x: 4, y: 2 }, { x: 4, y: 1 }, { maxJumpCost: 1 });
[];
grid.findPath({ x: 4, y: 2 }, { x: 4, y: 1 }, { maxJumpCost: 85 });
[
{ x: 4, y: 2 },
{ x: 4, y: 1 },
];