Add writing to console when player stats change
This commit is contained in:
parent
30896285db
commit
679cc3f9f4
22
src/ui/Ui.py
22
src/ui/Ui.py
@ -63,10 +63,24 @@ class Ui():
|
|||||||
font=self.font)
|
font=self.font)
|
||||||
|
|
||||||
def updateBasedOnPlayerStats(self, statistics: Statistics):
|
def updateBasedOnPlayerStats(self, statistics: Statistics):
|
||||||
self.healthBar.updateFill(statistics.hp)
|
consoleLines = []
|
||||||
self.hungerBar.updateFill(statistics.hunger)
|
if self.healthBar.value != statistics.hp:
|
||||||
self.staminaBar.updateFill(statistics.stamina)
|
self.healthBar.updateFill(statistics.hp)
|
||||||
self.thirstBar.updateFill(statistics.thirst)
|
consoleLines.append("Health: " + str(statistics.hp))
|
||||||
|
|
||||||
|
if self.hungerBar.value != statistics.hunger:
|
||||||
|
self.hungerBar.updateFill(statistics.hunger)
|
||||||
|
consoleLines.append("Hunger: " + str(statistics.hunger))
|
||||||
|
|
||||||
|
if self.staminaBar.value != statistics.stamina:
|
||||||
|
self.staminaBar.updateFill(statistics.stamina)
|
||||||
|
consoleLines.append("Stamina: " + str(statistics.stamina))
|
||||||
|
|
||||||
|
if self.thirstBar.value != 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
|
||||||
|
Loading…
Reference in New Issue
Block a user