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