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

View File

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

View File

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