From f45cafdf46455768985e3d3a118bbca1839e937f Mon Sep 17 00:00:00 2001 From: iamcheeseman <[hidden email]> Date: Sun, 15 Feb 2026 15:50:10 -0500 Subject: fix lame prop spawning bug --- src/player.odin | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/player.odin') diff --git a/src/player.odin b/src/player.odin index 7a0ee45..353254b 100644 --- a/src/player.odin +++ b/src/player.odin @@ -32,6 +32,7 @@ player: struct { state: Player_State, outside_room: bool, has_double_jumped: bool, + fall_height: f32, owns_double_jump: bool, owns_dash: bool, @@ -136,6 +137,7 @@ _default_state :: proc(dt: f32) { if .Down in collisions { player.coyote_time = PLAYER_COYOTE_TIME player.has_double_jumped = false + player.fall_height = pos.y } else { switch vel.y { case -math.INF_F32..<-50: @@ -149,6 +151,8 @@ _default_state :: proc(dt: f32) { if _can_wallslide(input) { _enter_wall_slide() } + + player.fall_height = min(pos.y, player.fall_height) } rel_mouse_pos := fw.get_mouse_pos() - pos @@ -202,6 +206,16 @@ _default_state :: proc(dt: f32) { phys.update_body(player.body) + new_collisions := phys.get_collisions(player.body) + + if .Down in new_collisions && .Down not_in collisions { + // just landed + height := phys.get_position(player.body).y + if height - player.fall_height > 16 * 16 { + log.info("DEAD") + } + } + // cam_pos := phys.get_position(player.body) - SCREEN_SIZE * 0.5 // fw.set_camera_pos(cam_pos) } @@ -241,6 +255,9 @@ _exit_dash :: proc() { vel := phys.get_velocity(player.body) phys.set_velocity(player.body, vel / 2) + + pos := phys.get_position(player.body) + player.fall_height = pos.y } @(private = "file") @@ -278,6 +295,9 @@ _wall_slide_state :: proc(dt: f32) { if fw.is_keybind_just_down(actions.jump) { _enter_wall_jump() } + + pos := phys.get_position(player.body) + player.fall_height = pos.y } @(private = "file") -- cgit v1.3-2-g0d8e