ich will fertig werden
This commit is contained in:
@@ -8,6 +8,7 @@ import asyncio
|
|||||||
import threading
|
import threading
|
||||||
|
|
||||||
class GameState:
|
class GameState:
|
||||||
|
playerCount = 0
|
||||||
players = None
|
players = None
|
||||||
credits = config.BALLS_PER_GAME
|
credits = config.BALLS_PER_GAME
|
||||||
isPlaying = False
|
isPlaying = False
|
||||||
@@ -44,9 +45,11 @@ class GameState:
|
|||||||
def endGame(self):
|
def endGame(self):
|
||||||
self.writeHighscore()
|
self.writeHighscore()
|
||||||
self.players = None
|
self.players = None
|
||||||
|
self.playerCount = 0
|
||||||
self._currentPlayer = self.dummyPlayer
|
self._currentPlayer = self.dummyPlayer
|
||||||
self.isPlaying = False
|
self.isPlaying = False
|
||||||
self.isStarted = False
|
self.isStarted = False
|
||||||
|
|
||||||
logging.info("Game ended")
|
logging.info("Game ended")
|
||||||
self.startIdleLoop()
|
self.startIdleLoop()
|
||||||
|
|
||||||
@@ -89,6 +92,7 @@ class GameState:
|
|||||||
self.deactivate_all()
|
self.deactivate_all()
|
||||||
|
|
||||||
def createPlayers(self, playerCount):
|
def createPlayers(self, playerCount):
|
||||||
|
self.playerCount = playerCount
|
||||||
players = []
|
players = []
|
||||||
for i in range(playerCount):
|
for i in range(playerCount):
|
||||||
player = self.playerStateFactory.createPlayerState(i)
|
player = self.playerStateFactory.createPlayerState(i)
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class EndBallEvent(Event):
|
|||||||
self.scorePoints()
|
self.scorePoints()
|
||||||
self.gameState.currentPlayer.deactivate()
|
self.gameState.currentPlayer.deactivate()
|
||||||
|
|
||||||
if self.gameState.currentPlayer.ballsLeft == 0 and self.gameState.currentPlayer.id == len(self.gameState.players):
|
if self.gameState.currentPlayer.ballsLeft == 0 and self.gameState.currentPlayer.id == len(self.gameState.players) - 1:
|
||||||
self.gameState.endGame()
|
self.gameState.endGame()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user