aboutsummaryrefslogtreecommitdiff
path: root/src/explosions.s
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mssola@mssola.com>2026-03-04 22:53:35 +0100
committerMiquel Sabaté Solà <mssola@mssola.com>2026-03-04 22:53:35 +0100
commit0c5af85cc0cb9bb39a3a72548e735b92daf0a28f (patch)
tree0879318ea266ae1c756529645a3e8fefbd059824 /src/explosions.s
parent196f2ac744fa8e0b6ce2da555e01178d04bfb322 (diff)
downloadjetpac.nes-0c5af85cc0cb9bb39a3a72548e735b92daf0a28f.tar.gz
jetpac.nes-0c5af85cc0cb9bb39a3a72548e735b92daf0a28f.zip
Add collision with the player
This allows for explosions to run after making the player to disappear, and it re-runs the entering scene timer. Signed-off-by: Miquel Sabaté Solà <mssola@mssola.com>
Diffstat (limited to 'src/explosions.s')
-rw-r--r--src/explosions.s14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/explosions.s b/src/explosions.s
index 6e04668..58a700e 100644
--- a/src/explosions.s
+++ b/src/explosions.s
@@ -31,19 +31,22 @@
;; 3. X coordinate.
zp_pool_base = $70 ; asan:reserve EXPLOSIONS_POOL_CAPACITY_BYTES
+ ;; Number of active explosions at the moment.
+ zp_active = $7C
+
;; The amount of time each explosion frame will take.
FRAME_TIME = HZ / 20
;; Initialize the pool of explosions for the game.
.proc init
lda #0
+ sta Explosions::zp_active
+
ldx #0
ldy #EXPLOSIONS_POOL_CAPACITY
-
@loop:
sta Explosions::zp_pool_base, x
NEXT_EXPLOSION_INDEX_X
-
dey
bne @loop
@@ -73,6 +76,9 @@
sta Explosions::zp_pool_base + 1, x
lda Globals::zp_arg3
sta Explosions::zp_pool_base + 2, x
+
+ ;; Increase the number of active explosions and quit.
+ inc Explosions::zp_active
rts
@next:
@@ -122,7 +128,9 @@
bne @next
@explosion_done:
- ;; We are actually done. Invalidate the explosion.
+ ;; We are actually done. Decrement the number of active explosions and
+ ;; invalidate this one.
+ dec Explosions::zp_active
ldy #0
__fallthrough__ @set_and_next