Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 6 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 (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T06:58:52.000Z (almost 2 years ago)
- Last Synced: 2024-10-30T00:46:00.801Z (about 2 months ago)
- Topics: map, pathfinding, tile, typescript
- Language: TypeScript
- Homepage:
- Size: 652 KB
- Stars: 0
- Watchers: 2
- 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 }
// ]
```