From 628b9a93875eb6ee43021576a0e5215fde777547 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Wed, 22 Oct 2025 05:33:34 +0200 Subject: [PATCH] ui: added player hp bar --- src/ui.s | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ui.s b/src/ui.s index 4d69e14..c4d3ef6 100644 --- a/src/ui.s +++ b/src/ui.s @@ -38,6 +38,7 @@ ui_draw_player_hp: ld hl, UI_PLAYER_HP+7 ld a, [player+act_hp] + ld b, a jp ui_draw_hp ; draws generic hp @@ -45,23 +46,25 @@ ui_draw_player_hp: ; hl: address to draw to ; b: current hp ui_draw_hp: + +@full_loop: ld a, b cp a, 4 jr c, @skip_full REL -@full_loop: ld a, UI_TILE_HP_4 ld [hl+], a ld a, b sub a, 4 ld b, a + jp z, @done jp c, @done ; no more hp to draw jr @full_loop REL @skip_full: - ld a, UI_TILE_HP_1 + ld a, UI_TILE_HP_1+1 sub a, b ld [hl+], a -- 2.30.2