diff options
| author | Miquel Sabaté Solà <mssola@mssola.com> | 2026-02-10 15:16:21 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mssola@mssola.com> | 2026-02-10 15:19:56 +0100 |
| commit | a6bd59a138673b78bc3da39096546b6725590a29 (patch) | |
| tree | 2267dd4007c33d36b659d164ee754b9757aeb83d /src/driver.s | |
| parent | 4f372e1639c0c43cf6926a100fbbce99585b0291 (diff) | |
| download | jetpac.nes-a6bd59a138673b78bc3da39096546b6725590a29.tar.gz jetpac.nes-a6bd59a138673b78bc3da39096546b6725590a29.zip | |
enemies: add inner movement and facing logic
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à <mssola@mssola.com>
Diffstat (limited to 'src/driver.s')
| -rw-r--r-- | src/driver.s | 14 |
1 files changed, 6 insertions, 8 deletions
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, |
