From e602dd3707f2b6ad3198a62497ca6ee311997485 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Fri, 6 Mar 2026 23:40:02 +0100 Subject: Convert enemy vs bullet collision into a loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The fact that unrolling the loop was easier or faster was a plain lie from my lazyness. Convert it into a proper loop just so we can experiment with adding more enemies in one screen. Signed-off-by: Miquel Sabaté Solà --- src/enemies.s | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/enemies.s') diff --git a/src/enemies.s b/src/enemies.s index b6005fc..33b4c33 100644 --- a/src/enemies.s +++ b/src/enemies.s @@ -17,13 +17,11 @@ ;; change it there. ENEMIES_POOL_CAPACITY = 3 - ;; The capacity of the enemies pool in bytes. - ENEMIES_POOL_CAPACITY_BYTES = ENEMIES_POOL_CAPACITY * 4 + ;; The amount of bytes each pool item takes. + SIZEOF_POOL_ITEM = 4 - ;; Indeces where each enemy definition starts on the pool. - ENEMY_0_IDX = 0 - ENEMY_1_IDX = 4 - ENEMY_2_IDX = 8 + ;; The capacity of the enemies pool in bytes. + ENEMIES_POOL_CAPACITY_BYTES = ENEMIES_POOL_CAPACITY * SIZEOF_POOL_ITEM ;; Initial X coordinates for enemies depending on if they appear on the ;; left/right edge of the screen. -- cgit v1.2.3