duke: avoid being able to double-jump

This commit is contained in:
Vince Weaver 2020-12-14 11:49:35 -05:00
parent 7c75cbb973
commit 67b78c5e1f
4 changed files with 20 additions and 3 deletions

View File

@ -8,11 +8,11 @@ move_duke:
jsr duke_get_feet_location ; get location of feet
jsr check_falling
jsr check_falling ; check for/handle falling
jsr duke_collide
jsr duke_collide ; check for right/left collision
jsr handle_jumping
jsr handle_jumping ; handle jumping
lda DUKE_WALKING
beq done_move_duke
@ -150,6 +150,10 @@ handle_jumping:
dec DUKE_Y
dec DUKE_Y
dec DUKE_JUMPING
bne done_handle_jumping
lda #1 ; avoid gap before falling triggered
sta DUKE_FALLING
done_handle_jumping:
rts
@ -247,6 +251,9 @@ check_falling:
;=======================
; falling
lda #1
sta DUKE_FALLING
; scroll but only if Y>=18
lda DUKE_Y
@ -266,6 +273,10 @@ scroll_fall:
feet_on_ground:
; clear falling
lda #0
sta DUKE_FALLING
; check to see if Y still hi, if so scroll back down
lda DUKE_Y

View File

@ -41,6 +41,7 @@ duke_start:
sta SCORE1
sta SCORE2
sta INVENTORY
sta DUKE_FALLING
lda #$10
sta SCORE0

View File

@ -192,6 +192,9 @@ space_pressed:
lda DUKE_JUMPING
bne done_keypress ; don't jump if already jumping
lda DUKE_FALLING
bne done_keypress ; don't jump if falling
lda #7
sta DUKE_JUMPING

View File

@ -107,6 +107,8 @@ SCORE1 = $92
SCORE2 = $93
UPDATE_STATUS = $94
DUKE_FALLING = $95
; done game puzzle state