aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <mikisabate@gmail.com>2025-04-02 21:33:21 +0200
committerMiquel Sabaté Solà <mikisabate@gmail.com>2025-04-02 21:33:21 +0200
commit4e5267ce1f247bf2c7336d79a16b6cd9a1d1c5ce (patch)
tree7edd7e321578067486b4782e22632d737727ff3a
parentbfb641e8bed8d33f6a3ab13870c93f0632eba9d8 (diff)
downloadjetpac.nes-4e5267ce1f247bf2c7336d79a16b6cd9a1d1c5ce.tar.gz
jetpac.nes-4e5267ce1f247bf2c7336d79a16b6cd9a1d1c5ce.zip
Full stop when not moving on walking state
Before this commit the same logic as in throttle state was applied in which acceleration was applied. This brings back the logic more closely to the original game. Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
-rw-r--r--src/player.s11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/player.s b/src/player.s
index b900e52..e86c491 100644
--- a/src/player.s
+++ b/src/player.s
@@ -370,11 +370,16 @@
lda #THROTTLE_RIGHT
bne @apply_acceleration
- ;; If neither left nor right is being pressed, go for a zero
- ;; acceleration, which will slow down the player instead of going to a
- ;; full stop.
+ ;; If neither left nor right is being pressed we have to move to a
+ ;; resting state on the horizontal axis. When throttling this means an
+ ;; acceleration of 0 (i.e. slow down), when walking this means going to
+ ;; an immediate full stop.
@nothing:
lda #0
+ bit zp_state
+ bmi @apply_acceleration
+ sta zp_velocity_x
+ beq @apply_velocity
;; As with vertical motion, `a` contains the acceleration to aim for,
;; and we just subtract the current velocity and see if we either have