Commit 9e295492 authored by Aurel Wildfellner's avatar Aurel Wildfellner

end process after each game, fullscreen by default

parent 81cff213
Pipeline #86 failed with stages
......@@ -180,12 +180,12 @@ class PongGame:
# End of Game?
if self.leftPlayer.lifes <= 0:
self.menuText = "Right Player Wins!"
self.gameState = GameState.STARTGAME
self.gameState = GameState.GAMEEND
print("RIGHT PLAYER WINS!")
return
if self.rightPlayer.lifes <= 0:
self.menuText = "Left Player Wins!"
self.gameState = GameState.STARTGAME
self.gameState = GameState.GAMEEND
print("LEFT PLAYER WINS!")
return
......@@ -257,10 +257,10 @@ class PongGame:
# end of rally?
if self.gamefield.ballLeftOut(self.ball):
self.leftPlayer.lifes -= 1
self.gameState = GameState.GAMEEND
self.gameState = GameState.SETUPRALLY
if self.gamefield.ballRightOut(self.ball):
self.rightPlayer.lifes -= 1
self.gameState = GameState.GAMEEND
self.gameState = GameState.SETUPRALLY
......@@ -269,18 +269,17 @@ def main():
print(PongConfig.gametitle)
utils.disableBarcodeKeyboards()
pg = PongGame()
DISPLAYSURF = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
if not pg.setupControllers():
print("Controller Error")
#exit(1)
while True:
pg = PongGame()
while True:
if pg.gameState == GameState.GAMEEND:
del pg
break
pg.gameLoop()
if pg.gameState == GameState.GAMEEND:
break
pg.gameLoop()
#TODO catch exceptions and stop barcode reader threads
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment