Reshaped the game layout using new lines and boxes

This commit is contained in:
Nicolas Margulies
2020-11-20 18:07:09 +01:00
parent 9ca6561bc3
commit ca57fae19d
4 changed files with 26 additions and 34 deletions

View File

@ -17,31 +17,27 @@ class StatsDisplay(Display):
self.player = p
def update_pad(self) -> None:
string = ""
for _ in range(self.width - 1):
string = string + "-"
self.pad.addstr(0, 0, string)
string2 = "Player -- LVL {} EXP {}/{} HP {}/{}"\
string2 = "Player -- LVL {}\nEXP {}/{}\nHP {}/{}"\
.format(self.player.level, self.player.current_xp,
self.player.max_xp, self.player.health,
self.player.maxhealth)
for _ in range(self.width - len(string2) - 1):
string2 = string2 + " "
self.pad.addstr(1, 0, string2)
string3 = "Stats : STR {} INT {} CHR {} DEX {} CON {}"\
self.pad.addstr(0, 0, string2)
string3 = "STR {}\nINT {}\nCHR {}\nDEX {}\nCON {}"\
.format(self.player.strength,
self.player.intelligence, self.player.charisma,
self.player.dexterity, self.player.constitution)
for _ in range(self.width - len(string3) - 1):
string3 = string3 + " "
self.pad.addstr(2, 0, string3)
self.pad.addstr(3, 0, string3)
inventory_str = "Inventaire : " + "".join(
self.pack[item.name.upper()] for item in self.player.inventory)
self.pad.addstr(3, 0, inventory_str)
self.pad.addstr(8, 0, inventory_str)
if self.player.dead:
self.pad.addstr(4, 0, "VOUS ÊTES MORT",
self.pad.addstr(10, 0, "VOUS ÊTES MORT",
curses.A_BOLD | curses.A_BLINK | curses.A_STANDOUT
| self.color_pair(3))
@ -49,4 +45,4 @@ class StatsDisplay(Display):
self.pad.clear()
self.update_pad()
self.pad.refresh(0, 0, self.y, self.x,
4 + self.y, self.width + self.x)
self.y + self.height - 1, self.width + self.x - 1)