Display the current floor in the StatsDisplay

This commit is contained in:
Yohann D'ANELLO 2021-01-06 15:17:02 +01:00
parent d06a405120
commit 4cd4bc9005
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
3 changed files with 13 additions and 8 deletions

View File

@ -20,15 +20,17 @@ class StatsDisplay(Display):
self.player = game.player
def update_pad(self) -> None:
string2 = "Player -- LVL {}\nEXP {}/{}\nHP {}/{}"\
.format(self.player.level, self.player.current_xp,
self.player.max_xp, self.player.health,
self.player.maxhealth)
string2 = f"{_(self.player.name).capitalize()} " \
f"-- LVL {self.player.level} -- " \
f"FLOOR {-self.player.map.floor}\n" \
f"EXP {self.player.current_xp}/{self.player.max_xp}\n" \
f"HP {self.player.health}/{self.player.maxhealth}"
self.addstr(self.pad, 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)
string3 = f"STR {self.player.strength}\n" \
f"INT {self.player.intelligence}\n" \
f"CHR {self.player.charisma}\n" \
f"DEX {self.player.dexterity}\n" \
f"CON {self.player.constitution}"
self.addstr(self.pad, 3, 0, string3)
inventory_str = _("Inventory:") + " "

View File

@ -173,6 +173,7 @@ class Game:
self.maps.append(Map.load(ResourceManager.get_asset_path(
"example_map_2.txt")))
new_map = self.map
new_map.floor = self.map_index
old_map.remove_entity(self.player)
new_map.add_entity(self.player)
if move_down:

View File

@ -35,6 +35,7 @@ class Map:
Object that represents a Map with its width, height
and tiles, that have their custom properties.
"""
floor: int
width: int
height: int
start_y: int
@ -49,6 +50,7 @@ class Map:
def __init__(self, width: int, height: int, tiles: list,
start_y: int, start_x: int):
self.floor = 0
self.width = width
self.height = height
self.start_y = start_y