Display inventory content in statdisplay
This commit is contained in:
parent
12c653fe15
commit
21e85078a4
|
@ -35,8 +35,13 @@ class StatsDisplay(Display):
|
|||
for _ in range(self.width - len(string3) - 1):
|
||||
string3 = string3 + " "
|
||||
self.pad.addstr(2, 0, string3)
|
||||
|
||||
inventory_str = "Inventaire : " + "".join(
|
||||
self.pack[item.name.upper()] for item in self.player.inventory)
|
||||
self.pad.addstr(3, 0, inventory_str)
|
||||
|
||||
if self.player.dead:
|
||||
self.pad.addstr(3, 0, "YOU ARE DEAD",
|
||||
self.pad.addstr(4, 0, "VOUS ÊTES MORT",
|
||||
curses.A_BOLD | curses.A_BLINK | curses.A_STANDOUT
|
||||
| self.color_pair(3))
|
||||
|
||||
|
@ -44,4 +49,4 @@ class StatsDisplay(Display):
|
|||
self.pad.clear()
|
||||
self.update_pad()
|
||||
self.pad.refresh(0, 0, self.y, self.x,
|
||||
3 + self.y, self.width + self.x)
|
||||
4 + self.y, self.width + self.x)
|
||||
|
|
|
@ -13,6 +13,8 @@ class Item(Entity):
|
|||
self.held = False
|
||||
|
||||
def drop(self, y: int, x: int) -> None:
|
||||
if self.held:
|
||||
self.held_by.inventory.remove(self)
|
||||
self.held = False
|
||||
self.held_by = None
|
||||
self.map.add_entity(self)
|
||||
|
|
|
@ -15,9 +15,13 @@ class Player(FightingEntity):
|
|||
level: int = 1
|
||||
current_xp: int = 0
|
||||
max_xp: int = 10
|
||||
inventory: list = list()
|
||||
inventory: list
|
||||
paths: Dict[Tuple[int, int], Tuple[int, int]]
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.inventory = list()
|
||||
|
||||
def move(self, y: int, x: int) -> None:
|
||||
"""
|
||||
When the player moves, move the camera of the map.
|
||||
|
|
Loading…
Reference in New Issue