|
|
@ -29,6 +29,7 @@ DEF PLAYER_SPEED EQU 2 |
|
|
|
|
|
|
|
DEF GRAVITY EQU (0 << 8) | $2e ; 0.18 |
|
|
|
DEF INIT_VY EQU (3 << 8) | $99 ; 3.60 |
|
|
|
DEF INIT_FALL_VY EQU ($ff << 8) | $1a ; a.b |
|
|
|
|
|
|
|
Player_Init:: |
|
|
|
; Clear player data |
|
|
@ -76,9 +77,7 @@ Player_Update:: |
|
|
|
ld [hl], 1 |
|
|
|
|
|
|
|
ld hl, PLAYER_VY |
|
|
|
ld [hl], HIGH(INIT_VY) |
|
|
|
inc hl |
|
|
|
ld [hl], LOW(INIT_VY) |
|
|
|
STORE16 INIT_VY |
|
|
|
|
|
|
|
; todo: deduplicate |
|
|
|
.jump_update_check: |
|
|
@ -188,13 +187,13 @@ Player_Update:: |
|
|
|
ld hl, keys |
|
|
|
ld a, [hl] |
|
|
|
and BTN_LEFT |
|
|
|
ret z |
|
|
|
jr z, .fall |
|
|
|
|
|
|
|
; check for left boundary |
|
|
|
ld hl, PLAYER_X |
|
|
|
ld a, [hl] |
|
|
|
or a |
|
|
|
ret z |
|
|
|
jr z, .fall |
|
|
|
|
|
|
|
sub PLAYER_SPEED |
|
|
|
ld [hl], a |
|
|
@ -206,12 +205,28 @@ Player_Update:: |
|
|
|
ld [hl], $ff |
|
|
|
|
|
|
|
call update_oam |
|
|
|
ret |
|
|
|
jr .fall |
|
|
|
|
|
|
|
.left_rollback: |
|
|
|
ld hl, PLAYER_X |
|
|
|
inc [hl] |
|
|
|
inc [hl] |
|
|
|
|
|
|
|
.fall: |
|
|
|
call player_in_air |
|
|
|
ret nz |
|
|
|
|
|
|
|
; only set jump state if not already jumping |
|
|
|
ld hl, PLAYER_JUMPING |
|
|
|
ld a, [hl] |
|
|
|
or a |
|
|
|
ret nz |
|
|
|
|
|
|
|
ld [hl], 1 |
|
|
|
|
|
|
|
ld hl, PLAYER_VY |
|
|
|
STORE16 INIT_FALL_VY |
|
|
|
|
|
|
|
ret |
|
|
|
|
|
|
|
; Update player metasprite with positional data |
|
|
|