mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-09-10 08:54:51 +00:00
duke: right/left collisions sorta work
This commit is contained in:
parent
da8c6a6044
commit
8e04567265
@ -1,4 +1,6 @@
|
||||
|
||||
DUKE_SPEED = $80
|
||||
|
||||
;=========================
|
||||
; move duke
|
||||
;=========================
|
||||
@ -8,6 +10,8 @@ move_duke:
|
||||
|
||||
jsr check_falling
|
||||
|
||||
jsr duke_collide
|
||||
|
||||
jsr handle_jumping
|
||||
|
||||
lda DUKE_WALKING
|
||||
@ -24,7 +28,7 @@ duke_scroll_right:
|
||||
|
||||
clc
|
||||
lda DUKE_XL
|
||||
adc #$40
|
||||
adc #DUKE_SPEED
|
||||
sta DUKE_XL
|
||||
bcc skip_duke_scroll_right
|
||||
|
||||
@ -39,7 +43,7 @@ skip_duke_scroll_right:
|
||||
duke_walk_right:
|
||||
lda DUKE_XL
|
||||
clc
|
||||
adc #$40
|
||||
adc #DUKE_SPEED
|
||||
sta DUKE_XL
|
||||
bcc dwr_noflo
|
||||
inc DUKE_X
|
||||
@ -56,7 +60,7 @@ duke_scroll_left:
|
||||
|
||||
sec
|
||||
lda DUKE_XL
|
||||
sbc #$40
|
||||
sbc #DUKE_SPEED
|
||||
sta DUKE_XL
|
||||
bcs skip_duke_scroll_left
|
||||
|
||||
@ -72,7 +76,7 @@ duke_walk_left:
|
||||
|
||||
lda DUKE_XL
|
||||
sec
|
||||
sbc #$40
|
||||
sbc #DUKE_SPEED
|
||||
sta DUKE_XL
|
||||
bcs dwl_noflo
|
||||
dec DUKE_X
|
||||
@ -92,9 +96,49 @@ done_move_duke:
|
||||
|
||||
duke_collide:
|
||||
|
||||
lda DUKE_DIRECTION
|
||||
beq done_duke_collide
|
||||
|
||||
bmi check_left_collide
|
||||
|
||||
check_right_collide:
|
||||
lda DUKE_FOOT_OFFSET
|
||||
clc
|
||||
adc #1 ; underfoot is on next row (+16)
|
||||
|
||||
tax
|
||||
lda TILEMAP,X
|
||||
|
||||
; if tile# < 32 then we are fine
|
||||
cmp #32
|
||||
bcc done_duke_collide ; blt
|
||||
|
||||
lda #0 ;
|
||||
sta DUKE_WALKING
|
||||
jmp done_duke_collide
|
||||
|
||||
check_left_collide:
|
||||
|
||||
lda DUKE_FOOT_OFFSET
|
||||
sec
|
||||
sbc #1 ; underfoot is on next row (+16)
|
||||
|
||||
tax
|
||||
lda TILEMAP,X
|
||||
|
||||
; if tile# < 32 then we are fine
|
||||
cmp #32
|
||||
bcc done_duke_collide ; blt
|
||||
|
||||
lda #0 ;
|
||||
sta DUKE_WALKING
|
||||
jmp done_duke_collide
|
||||
|
||||
done_duke_collide:
|
||||
rts
|
||||
|
||||
|
||||
|
||||
;=========================
|
||||
; check_jumping
|
||||
;=========================
|
||||
|
@ -192,7 +192,7 @@ space_pressed:
|
||||
lda DUKE_JUMPING
|
||||
bne done_keypress ; don't jump if already jumping
|
||||
|
||||
lda #6
|
||||
lda #7
|
||||
sta DUKE_JUMPING
|
||||
|
||||
jmp done_keypress
|
||||
|
Loading…
Reference in New Issue
Block a user