duke: can fall

This commit is contained in:
Vince Weaver 2020-12-10 19:59:34 -05:00
parent 5b3f545264
commit 19e128a4a6
1 changed files with 56 additions and 0 deletions

View File

@ -4,6 +4,8 @@
;=========================
move_duke:
jsr check_falling
lda DUKE_WALKING
beq done_move_duke
@ -50,6 +52,60 @@ done_move_duke:
rts
;=========================
; duke collide
;=========================
; only check above head if jumping
duke_collide:
rts
;=========================
; check_falling
;=========================
check_falling:
; check below feet
; block index below feet is (y+10)*16/4 + (x/2) + 1
lda DUKE_Y
clc
adc #10
asl
asl
asl
clc
adc DUKE_X
lsr ; have location of head
; clc
; adc #1 ; point under feet
tax
lda TILEMAP,X
; if < 32 then we fall
cmp #32
bcs done_check_below
; scroll
inc TILEMAP_Y
jsr copy_tilemap_subset
done_check_below:
rts
;=========================
; draw duke
;=========================