From 0c5af85cc0cb9bb39a3a72548e735b92daf0a28f Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 4 Mar 2026 22:53:35 +0100 Subject: Add collision with the player MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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à --- src/explosions.s | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/explosions.s') 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 -- cgit v1.2.3