Add writing to console when player stats change

This commit is contained in:
Michał Czekański 2020-04-06 00:10:40 +02:00
parent 30896285db
commit 679cc3f9f4

View File

@ -63,10 +63,24 @@ class Ui():
font=self.font) font=self.font)
def updateBasedOnPlayerStats(self, statistics: Statistics): def updateBasedOnPlayerStats(self, statistics: Statistics):
consoleLines = []
if self.healthBar.value != statistics.hp:
self.healthBar.updateFill(statistics.hp) self.healthBar.updateFill(statistics.hp)
consoleLines.append("Health: " + str(statistics.hp))
if self.hungerBar.value != statistics.hunger:
self.hungerBar.updateFill(statistics.hunger) self.hungerBar.updateFill(statistics.hunger)
consoleLines.append("Hunger: " + str(statistics.hunger))
if self.staminaBar.value != statistics.stamina:
self.staminaBar.updateFill(statistics.stamina) self.staminaBar.updateFill(statistics.stamina)
consoleLines.append("Stamina: " + str(statistics.stamina))
if self.thirstBar.value != statistics.thirst:
self.thirstBar.updateFill(statistics.thirst) self.thirstBar.updateFill(statistics.thirst)
consoleLines.append("Stamina: " + str(statistics.thirst))
self.console.addLinesToConsoleAndScrollToDisplayThem(consoleLines)
def updateBasedOnPygameEvent(self, event: pygame.event): def updateBasedOnPygameEvent(self, event: pygame.event):
pass pass