class arcade.AStarBarrierList(moving_sprite: Sprite, blocking_sprites: 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: Tuple[float, float], end_point: Tuple[float, float], astar_barrier_list: 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: Tuple[float, float], point_2: Tuple[float, float], walls: SpriteList, max_distance: int = -1, check_resolution: int = 2) bool[source]#

Determine if we have line of sight between two points. Try to make sure that spatial hashing is enabled on the wall SpriteList or this will be very slow.

  • point_1 (Point) – Start position

  • point_2 (Point) – End position position

  • walls (SpriteList) – List of all blocking sprites

  • max_distance (int) – Max distance point 1 can see

  • check_resolution (int) – Check every x pixels for a sprite. Trade-off between accuracy and speed.