Add passing events, stats to update Ui when handling events

This commit is contained in:
Michał Czekański 2020-04-05 23:45:19 +02:00
parent 0fb5f925d2
commit 17125f9dd9

View File

@ -25,11 +25,14 @@ class EventManager:
for event in pygame.event.get():
if event.type == pygame.QUIT:
self.game.running = False
self.game.screen.ui.updateBasedOnPygameEvent(event)
self.keyTimeout += self.keyTimer.tick()
if self.keyTimeout >= TIMEOUT:
self.handlePlayerControls(keys)
self.keyTimeout = 0
self.game.screen.ui.updateBasedOnPlayerStats(self.player.statistics)
def handlePlayerControls(self, keys):
# Key names are temporary
# TODO: Load key bindings from JSON