aboutsummaryrefslogtreecommitdiff
path: root/src/player.s
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mssola@mssola.com>2026-03-04 23:44:47 +0100
committerMiquel Sabaté Solà <mssola@mssola.com>2026-03-04 23:44:47 +0100
commitdbcbd43287a28bf087e20e660edd5ba40b5c27ec (patch)
treeae69b710c3b06bae58c18273af105855b3071ded /src/player.s
parent0c5af85cc0cb9bb39a3a72548e735b92daf0a28f (diff)
downloadjetpac.nes-dbcbd43287a28bf087e20e660edd5ba40b5c27ec.tar.gz
jetpac.nes-dbcbd43287a28bf087e20e660edd5ba40b5c27ec.zip
Update lifes left for player 1
The whole handling of player 2 will come whenever I set to implement multi-player for this game. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Diffstat (limited to 'src/player.s')
-rw-r--r--src/player.s23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/player.s b/src/player.s
index a821f0e..73ff20e 100644
--- a/src/player.s
+++ b/src/player.s
@@ -86,7 +86,8 @@
;; |-----+------------+-----------------------------------------------|
;; | 7 | thrust | Player is hitting the thrust |
;; | 6 | heading | heading right |
- ;; | 5-3 | - | Unused |
+ ;; | 5-4 | - | Unused |
+ ;; | 3 | life | Lifes should be updated on screen |
;; | 2 | update | Sprite (animation or heading) must be updated |
;; | 1-0 | walk | 0: still; 1: animation 1; 2: animation 2 |
zp_state = $50
@@ -102,6 +103,9 @@
zp_step_on_pal = $52
.endif
+ ;; Lifes for both players.
+ zp_lifes = $53 ; asan:reserve $02
+
;; How many animations are there for walking?
WALK_ANIMATION_NR = 3
@@ -830,7 +834,13 @@
;; That's just german for "the Bart, the".
.proc die_bart_die
- ;; TODO: dec lifes
+ ;; Decrement the life.
+ ;; TODO: this is just considering the first player only!.
+ dec Player::zp_lifes
+ beq @over
+ lda Player::zp_state
+ ora #%00001000
+ sta Player::zp_state
;; Move the player's sprites out of the screen.
ldx #0
@@ -853,5 +863,14 @@
lda Player::zp_screen_x
sta Globals::zp_arg3
JAL Explosions::create
+
+ @over:
+ ;; Set the proper flag for game over.
+ ;; TODO: game over (coin)
+ lda Globals::zp_flags
+ ora #%00000010
+ sta Globals::zp_flags
+
+ rts
.endproc
.endscope