extends Node3D @export var tween_duration := 0.5 var particles: GPUParticles3D var trails: GPUParticles3D var attractor: GPUParticlesAttractor3D var light: Light3D var sprite: Sprite3D var area: Area3D var collected_by: Player func _ready(): particles = %Particles trails = %Trail light = %Light sprite = %Sprite area = %Area attractor = %Attractor func _process(delta): if !collected_by: return global_position = Math.damp(global_position, Global.player.global_position + Vector3.UP, 1.0 * delta) func on_body_entered(body: Node3D): if body is Player: collected_by = body attractor.visible = false area.set_deferred("monitoring", false) particles.process_material.attractor_interaction_enabled = true var tween = get_tree().create_tween() tween.parallel().tween_property(particles, "amount_ratio", 0, tween_duration) # tween.parallel().tween_property(trails, "amount_ratio", 0, tween_duration) tween.parallel().tween_property(light, "light_energy", 0, tween_duration) tween.parallel().tween_property(sprite, "scale", Vector3.ZERO, tween_duration) tween.parallel().tween_property(sprite, "material_override:albedo_color", Color(0, 0, 0, 0), tween_duration) await tween.finished await get_tree().create_timer(2.0).timeout queue_free()