https://github.com/cygnusroboticus/basic-pathfinding-dep
Tile-based A* pathfinding in typescript
https://github.com/cygnusroboticus/basic-pathfinding-dep
map pathfinding tile typescript
Last synced: 5 days ago
JSON representation
Tile-based A* pathfinding in typescript
- Host: GitHub
- URL: https://github.com/cygnusroboticus/basic-pathfinding-dep
- Owner: CygnusRoboticus
- License: mit
- Created: 2018-12-15T06:08:16.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T06:58:52.000Z (over 2 years ago)
- Last Synced: 2025-04-04T09:15:13.930Z (3 months ago)
- Topics: map, pathfinding, tile, typescript
- Language: TypeScript
- Homepage:
- Size: 652 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# BasicPathfinding
Pathfinding is a simple package for performing 2D [A-star](https://en.wikipedia.org/wiki/A*_search_algorithm) pathfinding in square- and hex-based tile grids.
## Basic Usage
```typescript
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 }
// ]
```