diff --git a/main.py b/main.py index 7c7fbff..8fd694f 100644 --- a/main.py +++ b/main.py @@ -38,6 +38,8 @@ class Game: self.running = False print(e) + input("Press enter to leave from game") + def main() -> None: Game().play() diff --git a/out.py b/out.py index 526dc3b..c7736ef 100644 --- a/out.py +++ b/out.py @@ -36,3 +36,4 @@ class Out: ) frame.show() + print(F"Score: {pl.score}") diff --git a/player.py b/player.py index f609a57..66b4963 100644 --- a/player.py +++ b/player.py @@ -13,6 +13,8 @@ class Player: self.food = Food(0, 0, self) self.food.generate_new() + self.score = 0 + def update(self) -> None: sleep(1 / FPS) @@ -31,6 +33,7 @@ class Player: if self.body[-1] == self.food: self.food.generate_new() + self.score += 1 else: self.body.pop(0) diff --git a/point.py b/point.py index 8760254..d6d41e9 100644 --- a/point.py +++ b/point.py @@ -12,7 +12,7 @@ class Point: else: raise TypeError("You can compare only Point with Point") - def __hash__(self) -> None: + def __hash__(self) -> int: return int(f"{abs(self.x)}000{abs(self.y)}") def __str__(self) -> str: