ExCollision.Pathfinding.AStar
(ExCollision v1.1.0)
View Source
A* pathfinding over tilemap.
Uses ExCollision.Protocols.TileSource for walkability.
Coordinates are tile indices (column, row) or {x, y} in tiles.
Summary
Functions
Finds path from start to goal over the tilemap.
Checks whether a point on the tilemap is walkable.
Functions
@spec find_path( ExCollision.Protocols.TileSource.t(), {integer(), integer()}, {integer(), integer()}, keyword() ) :: {:ok, [{integer(), integer()}]} | {:error, :unreachable}
Finds path from start to goal over the tilemap.
start, goal — {tile_x, tile_y} (tile indices). Returns {:ok, [ {x, y}, ... ]} or {:error, :unreachable}.
Options:
:allow_diagonal— allow diagonal movement (8 directions). Defaultfalse(4 directions only).
Checks whether a point on the tilemap is walkable.