Class for displaying the player statistics (not yet tested)

This commit is contained in:
eichhornchen 2020-11-06 19:50:26 +01:00
parent bd9dd122f4
commit 1e2ff8a8ea
1 changed files with 13 additions and 0 deletions

View File

@ -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)