-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usage in a grid based system #9
Comments
Yes! You got it right. Your graph would be a grid. If you allow diagonal moves, then each node would have 8 neighbors. If you can only move horizontally and vertically, then each node would have just four neighbors. To make cells impassible, I think you can try two options:
|
Hey thanks for the reply. I added links to all cells and can confirm now it can find path to target. I'm still struggling with the Seems like the |
Quick update for anyone who's having a similar issue.. I did below which worked.
When I initialise the grid I create every node and links between every node and its neighbours. My grid has collisions like walls and such, when I create those object I just set the links between the object cell and its neighbours to When player or monster moves, I do it in two steps.
After making these changes it's all working great and more importantly, awesome performance. The only small issue is I am using TypeScript and there's no @types for this library, so had to set every type to |
Hi,
I’m developing a simple game on a 2D grid.
I have many enemies that have to find shortest path to the player every 0.5 second.
There’s static and dynamic obstacles in the grid (when an enemy or player moves, the tile it moves onto becomes an obstacle for other enemies).
In other words they can’t stand on the same tile.
I’m trying to use your library to implement this but a little confused as to how to code the obstacles bit.
Can I get some advice please? Do I have to add links to every walkable neighbour tile of each tile?
The text was updated successfully, but these errors were encountered: