Add a hint to tell the user how to use ladders

This commit is contained in:
Yohann D'ANELLO
2021-01-08 14:51:56 +01:00
parent f48377e055
commit 156e4a7e3a
7 changed files with 132 additions and 83 deletions

View File

@ -5,6 +5,7 @@ import curses
from ..entities.player import Player
from ..game import Game
from ..settings import Settings
from ..translations import gettext as _
from .display import Display
@ -14,6 +15,7 @@ class StatsDisplay(Display):
A class to handle the display of the stats of the player.
"""
player: Player
settings: Settings
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@ -21,6 +23,7 @@ class StatsDisplay(Display):
def update(self, game: Game) -> None:
self.player = game.player
self.settings = game.settings
def update_pad(self) -> None:
string2 = f"{_(self.player.name).capitalize()} " \
@ -77,6 +80,12 @@ class StatsDisplay(Display):
self.addstr(self.pad, 15, 0, _("YOU ARE DEAD"), curses.COLOR_RED,
bold=True, blink=True, standout=True)
if self.player.map.tiles[self.player.y][self.player.x].is_ladder():
msg = _("Use {key} to use the ladder") \
.format(key=self.settings.KEY_LADDER)
self.addstr(self.pad, self.height - 2, 0, msg,
italic=True, reverse=True)
def display(self) -> None:
self.pad.erase()
self.update_pad()