code-check-jay #1
1 changed files with 0 additions and 18 deletions
18
game.py
18
game.py
|
|
@ -123,24 +123,6 @@ class Game:
|
|||
else:
|
||||
self.color_item = (0, 0, 0)
|
||||
|
||||
def overlaps_rect(self, rect):
|
||||
nearest_x = self.x
|
||||
if self.x < rect.left:
|
||||
nearest_x = rect.left
|
||||
elif self.x > rect.right:
|
||||
nearest_x = rect.right
|
||||
|
||||
nearest_y = self.y
|
||||
if self.y < rect.top:
|
||||
nearest_y = rect.top
|
||||
elif self.y > rect.bottom:
|
||||
nearest_y = rect.bottom
|
||||
|
||||
dx = self.x - nearest_x
|
||||
dy = self.y - nearest_y
|
||||
distance_squared = dx * dx + dy * dy
|
||||
return distance_squared < self.radius * self.radius
|
||||
|
||||
|
||||
class Player:
|
||||
def __init__(self, game, pos: pygame.Vector2, width, height):
|
||||
|
|
|
|||
Loading…
Reference in a new issue