Added coins
This commit is contained in:
+6
-6
@@ -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
|
||||
Reference in New Issue
Block a user