how have you guys handled jumping? here's my routine:
it works, but it's hard on the eyes. playerJumpPtr is set to $00 when 'A' is pushed, and is increased every frame until it hits $0B. the "jump" bit in the player status is cleared at that point, and playerJumpPtr is ignored.
gravity has no effect while the "jump" bit is set, and the only thing that can interrupt the jumping process is collision with a vine.
Code:
SubPlayerJump: ldx playerJumpPtr
cpx PJUMPPTRNULL ; if(playerJumpPtr >= #11)
bcs ExitPlayerJump ; exit jump routine
cpx #00 ; if(playerJumpPtr == 0)
beq playerStartingJump ; skip over the ground check
lda Player1_Y1 ;
clc ; check if the bottom of Pitfall
adc #24 ; Harry's sprite is touching
cmp GROUNDLEVEL ; the ground on either level of
beq ExitPlayerJump ; terrain, and if it is, jump to
cmp TUNNELLEVEL ; exit the routine
beq ExitPlayerJump ;
playerStartingJump: ldy #00
loopUpdateMorePX: lda Player1_Y1, Y
clc
adc playerJumpTable, X
sta Player1_Y1, Y
iny
iny
iny
iny
cpy #$18
bne loopUpdateMorePX
inc playerJumpPtr
ExitPlayerJump: rts
playerJumpTable: .db $F8, $00, $FC, $FE, $FF, $00, $01, $02, $04, $00, $08
cpx PJUMPPTRNULL ; if(playerJumpPtr >= #11)
bcs ExitPlayerJump ; exit jump routine
cpx #00 ; if(playerJumpPtr == 0)
beq playerStartingJump ; skip over the ground check
lda Player1_Y1 ;
clc ; check if the bottom of Pitfall
adc #24 ; Harry's sprite is touching
cmp GROUNDLEVEL ; the ground on either level of
beq ExitPlayerJump ; terrain, and if it is, jump to
cmp TUNNELLEVEL ; exit the routine
beq ExitPlayerJump ;
playerStartingJump: ldy #00
loopUpdateMorePX: lda Player1_Y1, Y
clc
adc playerJumpTable, X
sta Player1_Y1, Y
iny
iny
iny
iny
cpy #$18
bne loopUpdateMorePX
inc playerJumpPtr
ExitPlayerJump: rts
playerJumpTable: .db $F8, $00, $FC, $FE, $FF, $00, $01, $02, $04, $00, $08
it works, but it's hard on the eyes. playerJumpPtr is set to $00 when 'A' is pushed, and is increased every frame until it hits $0B. the "jump" bit in the player status is cleared at that point, and playerJumpPtr is ignored.
gravity has no effect while the "jump" bit is set, and the only thing that can interrupt the jumping process is collision with a vine.