depth, waiting (with hp recovery), hit die for monsters, ui tweak

This commit is contained in:
Llywelwyn 2023-07-10 03:35:09 +01:00
parent b6522d42c3
commit b8f8691e90
5 changed files with 200 additions and 18 deletions

View file

@ -12,9 +12,9 @@ pub fn draw_ui(ecs: &World, ctx: &mut Rltk) {
let combat_stats = ecs.read_storage::<CombatStats>();
let players = ecs.read_storage::<Player>();
for (_player, stats) in (&players, &combat_stats).join() {
let health = format!(" HP: {} / {} ", stats.hp, stats.max_hp);
ctx.print_color(12, 43, RGB::named(rltk::YELLOW), RGB::named(rltk::BLACK), &health);
ctx.draw_bar_horizontal(28, 43, 51, stats.hp, stats.max_hp, RGB::named(rltk::RED), RGB::named(rltk::BLACK));
let health = format!(" HP {}/{} ", stats.hp, stats.max_hp);
ctx.print_color_right(36, 43, RGB::named(rltk::YELLOW), RGB::named(rltk::BLACK), &health);
ctx.draw_bar_horizontal(38, 43, 34, stats.hp, stats.max_hp, RGB::named(rltk::RED), RGB::named(rltk::BLACK));
}
// Render message log
@ -27,6 +27,11 @@ pub fn draw_ui(ecs: &World, ctx: &mut Rltk) {
y += 1;
}
// Render depth
let map = ecs.fetch::<Map>();
let depth = format!(" D{} ", map.depth);
ctx.print_color(74, 43, RGB::named(rltk::YELLOW), RGB::named(rltk::BLACK), &depth);
// Render mouse cursor
let mouse_pos = ctx.mouse_pos();
ctx.set_bg(mouse_pos.0, mouse_pos.1, RGB::named(rltk::MAGENTA));