From 3f7ed1e4b3173a82b19b449dc110b93b9d57f39c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Czeka=C5=84ski?= Date: Mon, 6 Apr 2020 13:48:36 +0200 Subject: [PATCH] Add updating console on players death and closing game after time delay --- src/game/EventManager.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/game/EventManager.py b/src/game/EventManager.py index 0a9cb43..ef84a55 100644 --- a/src/game/EventManager.py +++ b/src/game/EventManager.py @@ -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)