From 5d846b3914a032042d0549fd18724efcbf7d9bf9 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Thu, 25 May 2023 22:21:36 +0100 Subject: Finalised the HUD --- game/assets/lives.png | Bin 0 -> 5011 bytes game/assets/title_small.png | Bin 0 -> 4124 bytes game/main.asm | 107 +++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 102 insertions(+), 5 deletions(-) create mode 100644 game/assets/lives.png create mode 100644 game/assets/title_small.png diff --git a/game/assets/lives.png b/game/assets/lives.png new file mode 100644 index 0000000..df75390 Binary files /dev/null and b/game/assets/lives.png differ diff --git a/game/assets/title_small.png b/game/assets/title_small.png new file mode 100644 index 0000000..f55c080 Binary files /dev/null and b/game/assets/title_small.png differ diff --git a/game/main.asm b/game/main.asm index 253c812..bb2c97e 100644 --- a/game/main.asm +++ b/game/main.asm @@ -123,6 +123,12 @@ init_game: ldi ldi + ; initial lives + ld y, 3 + ld x, lives + ld [a : x], y + halt call clear_screen @@ -134,7 +140,55 @@ init_game: ; Update the HUD (score, lives, etc) ; update_hud: - ; erase + ; lives + + ; settings mode + ld y, 128 + ld b, 0xb0 + port b, y + + ; setup + inc b + + ; addr + ld y, lives_sprite + port b, y + + ; x, y + ld y, 4 + port b, y + port b, y + + ; w + ld y, 13 + port b, y + ; h + ld y, 8 + port b, y + + ; blit + dec b + ; write, transparent + ld y, 3 + port b, y + + ; digits + ld x, 1 + push x + + ; addr of the BCD number + ld x, lives + ; where we want the text + ld b, 13 + ld y, 4 + + call put_bcd_number + pop x + + ; erase score ; settings mode ld y, 128 @@ -177,7 +231,7 @@ update_hud: ld y, 1 port b, y - ; 6 digits + ; digits ld x, 6 push x @@ -189,8 +243,44 @@ update_hud: ld y, 4 call put_bcd_number - pop x + + ; small title + + ; settings mode + ld y, 128 + ld b, 0xb0 + port b, y + + ; setup + inc b + + ; addr + ld y, title_small + port b, y + + ; x + ld y, 52 + port b, y + ; y + ld y, 4 + port b, y + + ; w + ld y, 24 + port b, y + ; h + ld y, 8 + port b, y + + ; blit + dec b + ; write, transparent + ld y, 3 + port b, y + ret ; @@ -387,6 +477,8 @@ hiscore: .db 0, 1, 0, 0, 0, 0 score: .db 0, 0, 0, 0, 0, 0 +lives: + .db 0 ; ; entity data @@ -409,6 +501,8 @@ player_coord: .db ET_END ; sprite data +lives_sprite: + .incpng "assets/lives.png" player_sprite: .incpng "assets/player.png" pbullet_sprite: @@ -463,11 +557,14 @@ stars: ; menu data title: .incpng "assets/title.png" -font: - .incpng "assets/font.png" +title_small: + .incpng "assets/title_small.png" usebox: .incpng "assets/usebox.png" +font: + .incpng "assets/font.png" + ; texts press_start_text: .str "PRESS START!" -- cgit v1.2.3