diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-04-02 21:48:46 +0200 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-04-02 21:48:46 +0200 |
| commit | 9e22002d28a095bc2f39154535e8612d0fe004d6 (patch) | |
| tree | 0dd4224c456cab39335c30f3a4445e830fb1cb3b | |
| parent | 132b7b1cc8073df9cc334cd277e9182c3aa8bca5 (diff) | |
| download | jetpac.nes-9e22002d28a095bc2f39154535e8612d0fe004d6.tar.gz jetpac.nes-9e22002d28a095bc2f39154535e8612d0fe004d6.zip | |
Implement hover
This is a way to stop vertical velocity mid-air, which is something I
did not know you could do until I read the original manual. The down
arrow has been picked since it was the same choice of the original game
when played on joystick.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
| -rw-r--r-- | src/player.s | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/player.s b/src/player.s index 5fe6d59..aac5dd0 100644 --- a/src/player.s +++ b/src/player.s @@ -236,6 +236,18 @@ ;; Updates the `zp_velocity_y` and the `zp_position_y` depending on whether ;; the player is throttling or gravity should just apply. .proc update_vertical_position + ;; Is the player airborne and asking to hover? If so we can just skip + ;; everything. + bit zp_state + bpl @check_thrust + lda #Joypad::BUTTON_DOWN + and Joypad::zp_buttons1 + beq @check_thrust + lda #0 + sta zp_velocity_y + rts + + @check_thrust: ;; Check if the player is asking to thrust, otherwise apply gravity. lda #(Joypad::BUTTON_UP | Joypad::BUTTON_A) and Joypad::zp_buttons1 |
