diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-04-02 21:32:08 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-04-02 21:32:08 +0200 |
| commit | bfb641e8bed8d33f6a3ab13870c93f0632eba9d8 (patch) | |
| tree | 5271245e9f79e1b7561c30a189e4500d206853be | |
| parent | 88728b89fed87326dae23619e2e93d4bd060a3ea (diff) | |
| download | jetpac.nes-bfb641e8bed8d33f6a3ab13870c93f0632eba9d8.tar.gz jetpac.nes-bfb641e8bed8d33f6a3ab13870c93f0632eba9d8.zip | |
Switch to a throttle state when falling
As it's done in the original game, switch to a throttle state when
falling off a platform.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
| -rw-r--r-- | src/player.s | 22 |
1 files changed, 22 insertions, 0 deletions
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 |
