From 767f0f052fc812a169edda9526087fd69c1c8642 Mon Sep 17 00:00:00 2001 From: Joseph DiGiovanni Date: Tue, 25 Feb 2025 20:09:44 -0500 Subject: [PATCH] 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: