From 3c0bc7b64574bf34e43bdb2e475ad705beb3a14e Mon Sep 17 00:00:00 2001 From: Joseph DiGiovanni Date: Tue, 25 Feb 2025 16:52:10 -0500 Subject: [PATCH 1/3] Make falling platform frame rate independent --- objects/platform_falling.gd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/objects/platform_falling.gd b/objects/platform_falling.gd index 81b2dda..dd95e1f 100644 --- a/objects/platform_falling.gd +++ b/objects/platform_falling.gd @@ -12,7 +12,7 @@ func _process(delta): queue_free() # Remove platform if below threshold if falling: - gravity += 0.25 + gravity += 15.0 * delta func _on_body_entered(_body): From 767f0f052fc812a169edda9526087fd69c1c8642 Mon Sep 17 00:00:00 2001 From: Joseph DiGiovanni Date: Tue, 25 Feb 2025 20:09:44 -0500 Subject: [PATCH 2/3] Reorganize falling platform logic --- objects/platform_falling.gd | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/objects/platform_falling.gd b/objects/platform_falling.gd index dd95e1f..d2fedc2 100644 --- a/objects/platform_falling.gd +++ b/objects/platform_falling.gd @@ -1,19 +1,19 @@ extends Node3D var falling := false -var gravity := 0.0 +var fall_velocity := 0.0 func _process(delta): scale = scale.lerp(Vector3(1, 1, 1), delta * 10) # Animate scale - position.y -= gravity * delta + if falling: + fall_velocity += 15.0 * delta + position.y -= fall_velocity * delta + else: + fall_velocity = 0.0 if position.y < -10: queue_free() # Remove platform if below threshold - - if falling: - gravity += 15.0 * delta - func _on_body_entered(_body): if !falling: From ffa7ca68573e5b6459068ab744a01c703a6740ec Mon Sep 17 00:00:00 2001 From: Joseph DiGiovanni Date: Tue, 25 Feb 2025 20:13:18 -0500 Subject: [PATCH 3/3] Use physics_process to move falling platform --- objects/platform_falling.gd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/objects/platform_falling.gd b/objects/platform_falling.gd index d2fedc2..4fa22c0 100644 --- a/objects/platform_falling.gd +++ b/objects/platform_falling.gd @@ -3,7 +3,7 @@ extends Node3D var falling := false var fall_velocity := 0.0 -func _process(delta): +func _physics_process(delta): scale = scale.lerp(Vector3(1, 1, 1), delta * 10) # Animate scale if falling: