obstacle.py
1 from vector import Point 2 3 4 class Obstacle: 5 def __init__(self, p1: Point, p2: Point): 6 self.p1: Point = p1 7 self.p2: Point = p2 8 9 def check_collision(self, p: Point) -> bool: 10 return self.p1.x - 2 <= p.x <= self.p2.x + 2 and self.p1.y - 2 <= p.y <= self.p2.y + 2