From: Lukas Krickl Date: Wed, 22 Oct 2025 03:33:34 +0000 (+0200) Subject: ui: added player hp bar X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=628b9a93875eb6ee43021576a0e5215fde777547;p=gbrg%2F.git ui: added player hp bar --- 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