pythonarcade/arcade

has_line_of_sight: ZeroDivisionError

Closed this issue · 1 comments

When the distance between two positions are zero we get a ZeroDivisionError.

  File "D:\Documents\project\HorrorGame\ghost.py", line 33, in can_see_player
    return arcade.has_line_of_sight(self.position, player.position, walls, 200, 5)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Documents\project\HorrorGame\Lib\site-packages\arcade\paths.py", line 357, in has_line_of_sight
    u = step_distance / distance
        ~~~~~~~~~~~~~~^~~~~~~~~~
ZeroDivisionError: float division by zero

This is fixed in development so I'll just close this. We've been closing most things once they're merged now anyways.