Skip to content

accepted tile #22

Open
Open
@ghost

Description

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

Activity

veleek

veleek commented on Jan 28, 2021

@veleek

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @veleek

        Issue actions

          accepted tile · Issue #22 · digitsensitive/astar-typescript