From 1e2ff8a8ea7657329872346f5eb194fd002bb258 Mon Sep 17 00:00:00 2001 From: eichhornchen Date: Fri, 6 Nov 2020 19:50:26 +0100 Subject: [PATCH] Class for displaying the player statistics (not yet tested) --- dungeonbattle/display/statsdisplay.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 dungeonbattle/display/statsdisplay.py diff --git a/dungeonbattle/display/statsdisplay.py b/dungeonbattle/display/statsdisplay.py new file mode 100644 index 0000000..0a5d248 --- /dev/null +++ b/dungeonbattle/display/statsdisplay.py @@ -0,0 +1,13 @@ +class StatsDisplay: + def __init__(self, player, height, width, topleftx, toplefty) : + self.width = width + self.height = height + self.pad = curses.newpad(height, width) + def update_pad(self) : + string = "Player -- LVL {} EXP {}/{} HP {}/{}\nStats : STR {} INT {} CHR {} DEX {} CON {}".format(player.level, player.currentXP, player.maxXP, player.health, player.maxhealth, player.strength, player.intelligence, player.charisma, player.dexterity, player.constitution) + self.pad.addstr(0, 0, string) + def refresh(self) : + self.pad.clear() + self.update_pad() + self.pad.refresh(0, 0, toplefty, topleftx, heigth+toplefty, width+topleftx) +