day 20 - fixed collision issues
This commit is contained in:
@ -39,11 +39,9 @@ class GameManager:
|
||||
return wall_collision or snake_collision
|
||||
|
||||
def is_food_eaten(self):
|
||||
snake_x, snake_y = self.snake.get_head_position()
|
||||
food_x, food_y = self.food.get_position()
|
||||
snake_head = self.snake.get_head()
|
||||
|
||||
if int(snake_x) == int(food_x) and int(snake_y) == int(food_y):
|
||||
print("Yihaa")
|
||||
if snake_head.distance(self.food) <= 15:
|
||||
self.food.hide()
|
||||
self.snake.extend()
|
||||
self.food_on_screen = False
|
||||
|
||||
Reference in New Issue
Block a user