class arcade.AStarBarrierList(moving_sprite: arcade.sprite.Sprite, blocking_sprites: arcade.sprite_list.sprite_list.SpriteList, grid_size: int, left: int, right: int, bottom: int, top: int)[source]

Class that manages a list of barriers that can be encountered during A* path finding.

  • moving_sprite (Sprite) – Sprite that will be moving

  • blocking_sprites (SpriteList) – Sprites that can block movement

  • grid_size (int) – Size of the grid, in pixels

  • left (int) – Left border of playing field

  • right (int) – Right border of playing field

  • bottom (int) – Bottom of playing field

  • top (int) – Top of playing field


Recalculate blocking sprites.


arcade.astar_calculate_path(start_point: Union[Tuple[float, float], List[float]], end_point: Union[Tuple[float, float], List[float]], astar_barrier_list: arcade.paths.AStarBarrierList, diagonal_movement=True)[source]
  • start_point (Point) –

  • end_point (Point) –

  • astar_barrier_list (AStarBarrierList) –

  • diagonal_movement (bool) –

Returns: List


arcade.has_line_of_sight(point_1: Union[Tuple[float, float], List[float]], point_2: Union[Tuple[float, float], List[float]], walls: arcade.sprite_list.sprite_list.SpriteList, max_distance: int = - 1) bool[source]

Determine if we have line of sight between two points. Having a line of sight means, that you can connect both points with straight line without intersecting any obstacle. Thanks to the shapely efficiency and speedups boost, this function is very fast. It can easily test 10 000 lines_of_sight.

  • point_1 – tuple – coordinates of first position (x, y)

  • point_2 – tuple – coordinates of second position (x, y)

  • walls – list – Obstacle objects to check against

  • max_distance – int –


tuple – (bool, list)