diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-05-25 22:21:36 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-05-25 22:21:36 +0100 |
commit | 5d846b3914a032042d0549fd18724efcbf7d9bf9 (patch) | |
tree | 2f817f574e4850e24681ed4a78d9b2352197910b | |
parent | 607865f4a8b5662606bd3d361b6a194b016775fc (diff) | |
download | tr8vm-5d846b3914a032042d0549fd18724efcbf7d9bf9.tar.gz tr8vm-5d846b3914a032042d0549fd18724efcbf7d9bf9.zip |
Finalised the HUD
-rw-r--r-- | game/assets/lives.png | bin | 0 -> 5011 bytes | |||
-rw-r--r-- | game/assets/title_small.png | bin | 0 -> 4124 bytes | |||
-rw-r--r-- | game/main.asm | 107 |
3 files changed, 102 insertions, 5 deletions
diff --git a/game/assets/lives.png b/game/assets/lives.png Binary files differnew file mode 100644 index 0000000..df75390 --- /dev/null +++ b/game/assets/lives.png diff --git a/game/assets/title_small.png b/game/assets/title_small.png Binary files differnew file mode 100644 index 0000000..f55c080 --- /dev/null +++ b/game/assets/title_small.png 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, >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 + 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 + ld a, >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 + 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!" |