Add updating console on players death and closing game after time delay
This commit is contained in:
parent
2893b4dd2c
commit
3f7ed1e4b3
@ -16,6 +16,8 @@ class EventManager:
|
||||
self.game = gameObject
|
||||
self.player = player
|
||||
self.keyTimer = pygame.time.Clock()
|
||||
|
||||
self.turnOff = False
|
||||
# Player controls
|
||||
|
||||
# TODO
|
||||
@ -25,6 +27,10 @@ class EventManager:
|
||||
def handleEvents(self):
|
||||
pygame.event.pump()
|
||||
|
||||
if self.turnOff:
|
||||
sleep(5)
|
||||
exit(0)
|
||||
|
||||
self.game.screen.ui.updateTime()
|
||||
|
||||
keys = pygame.key.get_pressed()
|
||||
@ -37,6 +43,9 @@ class EventManager:
|
||||
if self.player.alive:
|
||||
self.handlePlayerControls(keys)
|
||||
self.keyTimeout = 0
|
||||
else:
|
||||
self.game.screen.ui.updateOnDeath(self.player)
|
||||
self.turnOff = True
|
||||
|
||||
self.game.screen.ui.updateBarsBasedOnPlayerStats(self.player.statistics)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user