From a6bd59a138673b78bc3da39096546b6725590a29 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Tue, 10 Feb 2026 15:16:21 +0100 Subject: enemies: add inner movement and facing logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enemies now have the ability to be displayed on screen, face at the direction that they were assigned to at random during initialization time, and they also have a timer that dictates some inner movement, similarly as it happened in the original game. Signed-off-by: Miquel Sabaté Solà --- src/driver.s | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/driver.s') diff --git a/src/driver.s b/src/driver.s index 183c63f..a52051c 100644 --- a/src/driver.s +++ b/src/driver.s @@ -156,6 +156,8 @@ @do_update: jsr Player::update jsr Bullets::update + jsr Enemies::update + __fallthrough__ sprite_cycling .endproc @@ -229,16 +231,12 @@ stx zp_first_enemy lda Enemies::zp_enemies_pool_base, x - ;; Is this a valid enemy? + ;; Is this a valid enemy? If so allocate it and 'Enemies::allocate_x_y' + ;; will be responsible for increasing the value of 'y' with the number + ;; of sprites allocated (i.e. 16). cmp #$FF beq @after_first_enemy - - ;; Yes! Let's prepare the arguments an allocate an enemy. - lda Enemies::zp_enemies_pool_base + 1, x - sta Globals::zp_arg0 - lda Enemies::zp_enemies_pool_base + 2, x - sta Globals::zp_arg1 - jsr Enemies::allocate_sprite_y + jsr Enemies::allocate_x_y @after_first_enemy: ;; Increase the index for the enemies cycling. If wrapping is detected, -- cgit v1.2.3