From 9e22002d28a095bc2f39154535e8612d0fe004d6 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Wed, 2 Apr 2025 21:48:46 +0200 Subject: Implement hover MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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à --- src/player.s | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 -- cgit v1.2.3