diff --git a/food.py b/food.py index 2f9076d..612e08f 100644 --- a/food.py +++ b/food.py @@ -4,9 +4,8 @@ from settings import * class Food(Point): - def __init__(self, x, y, pl): + def __init__(self, x, y): Point.__init__(self, x, y) - self.pl = pl def generate_new(self) -> None: self.x = randint(0, WIDTH - 1) diff --git a/main.py b/main.py index 5be036d..e886677 100644 --- a/main.py +++ b/main.py @@ -14,13 +14,13 @@ class Game: self.is_pause = False kb.add_hotkey(QUIT_BUTTON, self.stop_game) - kb.add_hotkey(PAUSE_BUTTON, self.pause_game) + kb.add_hotkey(PAUSE_BUTTON, self.switch_pause) kb.add_hotkey(LEFT_BUTTON, self.pl.left) kb.add_hotkey(RIGHT_BUTTON, self.pl.right) kb.add_hotkey(UP_BUTTON, self.pl.up) kb.add_hotkey(DOWN_BUTTON, self.pl.down) - def pause_game(self) -> None: + def switch_pause(self) -> None: self.is_pause = not self.is_pause def stop_game(self) -> None: diff --git a/player.py b/player.py index ae96838..b7a6b99 100644 --- a/player.py +++ b/player.py @@ -8,7 +8,7 @@ class Player: self.direction = MAIN_DIRECTION self.body = [Point(MAIN_X, MAIN_Y)] - self.food = Food(0, 0, self) + self.food = Food(0, 0) self.food.generate_new() self.score = 1