Skip to content

CygnusRoboticus/basic-pathfinding-dep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BasicPathfinding

Pathfinding is a simple package for performing 2D A-star pathfinding in square- and hex-based tile grids.

Basic Usage

import Pathfinding, { Grid } from 'basic-pathfinding';

const grid = new Grid({
  tiles: [
    [1, 1, 0, 1, 1],
    [1, 1, 0, 1, 1],
    [1, 1, 0, 1, 1],
    [1, 1, 1, 1, 1],
    [1, 1, 1, 1, 1]
  ],
  walkableTiles: [1]
});

const path = await Pathfinding.findPath(grid, 1, 2, 3, 2);
// [
//   { x: 1, y: 2 },
//   { x: 1, y: 3 },
//   { x: 2, y: 3 },
//   { x: 3, y: 3 },
//   { x: 3, y: 2 }
// ]

About

Tile-based A* pathfinding in typescript

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published