Added coins

This commit is contained in:
2026-10-10 15:28:42 +02:00
parent 9030146ec8
commit 10a3d93821
7 changed files with 59 additions and 8 deletions
+6 -6
View File
@@ -1,7 +1,7 @@
"""
Represents the current state of the game.
Contains :
- Player score
- Player coins
- stopGame flag
- Player position
"""
@@ -10,15 +10,12 @@ class GameState:
PLAYER_VELOCITIES = [*PLAYER_MOVEMENTS, "down"]
def __init__(self):
self.score = 0
self.playerPosition = (0, 0)
self.stopGame = False
self.movesCount = 0
self.playerVelocity = -1 # -1 means no velocity
self.gameWon = False
def add_score(self, points):
self.score += points
self.coins = 0
def set_player_position(self, x, y):
self.playerPosition = (x, y)
@@ -43,4 +40,7 @@ class GameState:
self.stopGame = stop
def set_game_won(self, won):
self.gameWon = won
self.gameWon = won
def add_coin(self):
self.coins += 1