Better stats display (tested)
This commit is contained in:
parent
aeb43a0cec
commit
4ea3d20b28
|
@ -14,18 +14,29 @@ class StatsDisplay:
|
||||||
self.pad = curses.newpad(height, width)
|
self.pad = curses.newpad(height, width)
|
||||||
|
|
||||||
def update_pad(self) -> None:
|
def update_pad(self) -> None:
|
||||||
string = "Player -- LVL {} EXP {}/{} HP {}/{}\n" \
|
string = ""
|
||||||
"Stats : STR {} INT {} CHR {} DEX {} CON {}"\
|
for i in range(self.width-1) :
|
||||||
|
string = string + "-"
|
||||||
|
string = string
|
||||||
|
self.pad.addstr(0, 0, string)
|
||||||
|
string2 = "Player -- LVL {} EXP {}/{} HP {}/{}"\
|
||||||
.format(self.player.level, self.player.current_xp,
|
.format(self.player.level, self.player.current_xp,
|
||||||
self.player.max_xp, self.player.health,
|
self.player.max_xp, self.player.health,
|
||||||
self.player.maxhealth, self.player.strength,
|
self.player.maxhealth)
|
||||||
|
for i in range(self.width-len(string2)-1) :
|
||||||
|
string2 = string2 + " "
|
||||||
|
self.pad.addstr(1, 0, string2)
|
||||||
|
string3 = "Stats : STR {} INT {} CHR {} DEX {} CON {}"\
|
||||||
|
.format(self.player.strength,
|
||||||
self.player.intelligence, self.player.charisma,
|
self.player.intelligence, self.player.charisma,
|
||||||
self.player.dexterity, self.player.constitution)
|
self.player.dexterity, self.player.constitution)
|
||||||
self.pad.addstr(0, 0, string)
|
for i in range(self.width-len(string3)-1) :
|
||||||
|
string3 = string3 + " "
|
||||||
|
self.pad.addstr(2, 0, string3)
|
||||||
|
|
||||||
def refresh(self) -> None:
|
def refresh(self) -> None:
|
||||||
self.pad.clear()
|
self.pad.clear()
|
||||||
self.update_pad()
|
self.update_pad()
|
||||||
self.pad.refresh(0, 0, self.toplefty, self.topleftx,
|
self.pad.refresh(0, 0, self.toplefty, self.topleftx,
|
||||||
self.heigth + self.toplefty,
|
2+ self.toplefty,
|
||||||
self.width+ self.topleftx)
|
self.width+ self.topleftx)
|
||||||
|
|
Loading…
Reference in New Issue