aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.nasm/segments.txt2
-rw-r--r--src/enemies.s9
2 files changed, 10 insertions, 1 deletions
diff --git a/.nasm/segments.txt b/.nasm/segments.txt
index 96d2f66..5907869 100644
--- a/.nasm/segments.txt
+++ b/.nasm/segments.txt
@@ -1,4 +1,4 @@
- HEADER: 16/16 (100%)
-- ROM0: 6555/32762 (20.01%)
+- ROM0: 6561/32762 (20.03%)
- ROMV: 6/6 (100%)
- ROM2: 8192/8192 (100%)
diff --git a/src/enemies.s b/src/enemies.s
index 64e4b23..000b50d 100644
--- a/src/enemies.s
+++ b/src/enemies.s
@@ -386,6 +386,15 @@
;; Restore the value from the 'x' register.
ldx Enemies::zp_pool_index
+ ;; The enemy might have been burst to dust due to ground
+ ;; collision. Let's check it here and skip player collision if that's
+ ;; the case. This is not just an optimization detail, but otherwise we
+ ;; might get two explosions on the corner case of an enemy exploding due
+ ;; to background collision and colliding with the player at the same.
+ lda Enemies::zp_enemies_pool_base, x
+ cmp #$FF
+ beq @increase_index_next
+
;; Save the current tile coordinates for this enemy.
lda Enemies::zp_enemies_pool_base + 1, x
lsr