From bfb641e8bed8d33f6a3ab13870c93f0632eba9d8 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 2 Apr 2025 21:32:08 +0200 Subject: Switch to a throttle state when falling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As it's done in the original game, switch to a throttle state when falling off a platform. Signed-off-by: Miquel Sabaté Solà --- src/player.s | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/player.s') diff --git a/src/player.s b/src/player.s index ebf6dfb..b900e52 100644 --- a/src/player.s +++ b/src/player.s @@ -206,6 +206,28 @@ ;; handle ejection logic now. jsr background_check + ;; After we have a new velocity while taking the background into + ;; account. Are we suddently falling? + lda zp_velocity_y + beq @do_update_sprites + bmi @do_update_sprites + bit zp_state + bmi @do_update_sprites + + ;; We are falling: we were at a walking state and now we are falling. + ;; This happens whenever we fall from a platform by walking. The + ;; original game then switched into airborne state, so let's do that. In + ;; particular, we reset the walking counter, the walk state, and we flip + ;; the `throttle` flag. + lda #0 + sta zp_walk_counter + lda #%11111100 + and zp_state + lda #%10000000 + ora zp_state + sta zp_state + + @do_update_sprites: ;; And with that, update all the sprites with the information we have ;; collected (i.e. heading, throttle, coordinates). JAL update_sprites -- cgit v1.2.3