Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

accepted tile #22

Open
ghost opened this issue Dec 27, 2020 · 1 comment
Open

accepted tile #22

ghost opened this issue Dec 27, 2020 · 1 comment

Comments

@ghost
Copy link

ghost commented Dec 27, 2020

Hi!
How i set the accepted tile on the grid? By default, the astar accept the 0 and 1, but I would like to add the 2, 3, 4 ecc up to 9

@veleek
Copy link

veleek commented Jan 28, 2021

The current code appears to accept any boolean-ish value:

if (matrix[y][x]) {

0, false, null, undefined should map to unwalkable, everything else should be walkable.

But providing a predicate to the config to determine if the value is acceptable would be good too. And at the same time accepting an object array instead of a numeric array would be useful so that I can pass in an array of Tile objects (I'm using Phaser tilemaps in this case) and have a callback that determines whether that tile is walkable or not.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant