pathfinding.ts
TypeScript icon, indicating that this package has built-in type declarations

1.4.1 • Public • Published

pathfinding.ts

npm i pathfinding.ts

Finders:

  • [x] Jump Point - No Diagonal Movement

Grid example

Jump point: 10

const grid = new Grid([
    [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],
]);

PF example 1

grid.findPath(
    { x: 4, y: 2 }, 
    { x: 4, y: 1 }, 
    10,
    FinderEnum.JUMP_POINT
);
[
  { x: 4, y: 2 },
  { x: 4, y: 4 },
  { x: 0, y: 4 },
  { x: 0, y: 0 },
  { x: 4, y: 0 },
  { x: 4, y: 1 }
]

PF example 2

grid.findPath(
    { x: 4, y: 2 }, 
    { x: 4, y: 1 }, 
    1
);
[ ]

PF example 3

grid.findPath(
    { x: 4, y: 2 }, 
    { x: 4, y: 1 }, 
    85
);
[
  { x: 4, y: 2 },
  { x: 4, y: 1 }
]

Readme

Keywords

Package Sidebar

Install

npm i pathfinding.ts

Weekly Downloads

0

Version

1.4.1

License

MIT

Unpacked Size

24.6 kB

Total Files

29

Last publish

Collaborators

  • pagoru