From 5fc5ddf520d54d946546c9dfada6d7611e591280 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Mon, 8 Dec 2025 11:41:57 +0100 Subject: [PATCH] player: Added player max jump --- src/player.s | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/player.s b/src/player.s index 645418f..3dea74f 100644 --- a/src/player.s +++ b/src/player.s @@ -1,6 +1,7 @@ #define PLAYER_CURSOR_L 0x88 #define PLAYER_CURSOR_R 0x8A +#define PLAYER_JUMP_MAX 32 ; sets up the player actor player_init: @@ -78,14 +79,22 @@ player_update: 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 @@ -96,6 +105,7 @@ player_update: xor a, a ld [player_jump_peak], a + ld [player_jump_timer], a @not_down_collision: ret @@ -127,6 +137,10 @@ player_handle_move: 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 -- 2.30.2