#define PLAYER_CURSOR_L 0x88
#define PLAYER_CURSOR_R 0x8A
+#define PLAYER_JUMP_MAX 32
; sets up the player actor
player_init:
pop de
call act_test_tile_collision
+
+ ; check if jump timer is > max
+ ld a, [player_jump_timer]
+ cp a, PLAYER_JUMP_MAX
+ jr nc, @stop_jump REL
+ ; check if collided with ceiling
ld a, [col_tile_collided_with]
and a, DIRUP
jr z, @not_up_collision REL
+@stop_jump:
ld a, 1
ld [player_jump_peak], a
@not_up_collision:
-
+
+ ; check if touching floor
ld a, [col_tile_collided_with]
and a, DIRDOWN
jr z, @not_down_collision REL
xor a, a
ld [player_jump_peak], a
+ ld [player_jump_timer], a
@not_down_collision:
ret
cp a, 0
jr nz, @not_up REL
+ ld a, [player_jump_timer]
+ inc a
+ ld [player_jump_timer], a
+
ld a, [player+act_pos_y]
cp a, 0 ; min value
jr z, @not_up REL