Reorganize falling platform logic

pull/25/head
Joseph DiGiovanni 2025-02-25 20:09:44 +07:00
parent 3c0bc7b645
commit 767f0f052f
1 changed files with 6 additions and 6 deletions

@ -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: