Show HP of player
This commit is contained in:
parent
c81d0eda5e
commit
c3a906e2b3
13
engine.py
13
engine.py
@ -9,17 +9,14 @@ from tcod.map import compute_fov
|
|||||||
from input_handlers import EventHandler
|
from input_handlers import EventHandler
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from entity import Entity
|
from entity import Actor
|
||||||
from game_map import GameMap
|
from game_map import GameMap
|
||||||
|
|
||||||
|
|
||||||
class Engine:
|
class Engine:
|
||||||
game_map: GameMap
|
game_map: GameMap
|
||||||
|
|
||||||
def __init__(
|
def __init__(self, player: Actor):
|
||||||
self,
|
|
||||||
player: Entity
|
|
||||||
):
|
|
||||||
self.event_handler: EventHandler = EventHandler(self)
|
self.event_handler: EventHandler = EventHandler(self)
|
||||||
self.player = player
|
self.player = player
|
||||||
|
|
||||||
@ -42,6 +39,12 @@ class Engine:
|
|||||||
def render(self, console: Console, context: Context) -> None:
|
def render(self, console: Console, context: Context) -> None:
|
||||||
self.game_map.render(console)
|
self.game_map.render(console)
|
||||||
|
|
||||||
|
console.print(
|
||||||
|
x=1,
|
||||||
|
y=47,
|
||||||
|
string=f"HP: {self.player.fighter.hp}/{self.player.fighter.max_hp}",
|
||||||
|
)
|
||||||
|
|
||||||
# Actually output to screen
|
# Actually output to screen
|
||||||
context.present(console)
|
context.present(console)
|
||||||
console.clear()
|
console.clear()
|
||||||
|
Loading…
Reference in New Issue
Block a user