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.game = gameObject
|
||||||
self.player = player
|
self.player = player
|
||||||
self.keyTimer = pygame.time.Clock()
|
self.keyTimer = pygame.time.Clock()
|
||||||
|
|
||||||
|
self.turnOff = False
|
||||||
# Player controls
|
# Player controls
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
@ -25,6 +27,10 @@ class EventManager:
|
|||||||
def handleEvents(self):
|
def handleEvents(self):
|
||||||
pygame.event.pump()
|
pygame.event.pump()
|
||||||
|
|
||||||
|
if self.turnOff:
|
||||||
|
sleep(5)
|
||||||
|
exit(0)
|
||||||
|
|
||||||
self.game.screen.ui.updateTime()
|
self.game.screen.ui.updateTime()
|
||||||
|
|
||||||
keys = pygame.key.get_pressed()
|
keys = pygame.key.get_pressed()
|
||||||
@ -37,6 +43,9 @@ class EventManager:
|
|||||||
if self.player.alive:
|
if self.player.alive:
|
||||||
self.handlePlayerControls(keys)
|
self.handlePlayerControls(keys)
|
||||||
self.keyTimeout = 0
|
self.keyTimeout = 0
|
||||||
|
else:
|
||||||
|
self.game.screen.ui.updateOnDeath(self.player)
|
||||||
|
self.turnOff = True
|
||||||
|
|
||||||
self.game.screen.ui.updateBarsBasedOnPlayerStats(self.player.statistics)
|
self.game.screen.ui.updateBarsBasedOnPlayerStats(self.player.statistics)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user