DreamBall/elements/ring.tscn
2025-02-22 19:46:19 +01:00

47 lines
1.6 KiB
Text

[gd_scene load_steps=7 format=3 uid="uid://cpm3laywhlbq5"]
[ext_resource type="Material" uid="uid://brwwlwb1rpro7" path="res://levels/base/material.tres" id="1_48h5f"]
[ext_resource type="AudioStream" uid="uid://b0cl5v6q1ocbv" path="res://sounds/ring1.ogg" id="2_2so43"]
[ext_resource type="AudioStream" uid="uid://cvvs74ep5d4wt" path="res://sounds/ring2.ogg" id="3_lkqw0"]
[sub_resource type="GDScript" id="GDScript_86vhg"]
script/source = "extends CSGTorus3D
var happy_material = preload(\"res://graphics/happy_material.tres\")
var collected = false
func _on_area_3d_body_entered(body: Node3D) -> void:
if collected == false and body.name == \"Sphere\":
self.material = happy_material
collected = true
$AudioStreamPlayer.play()
"
[sub_resource type="CylinderShape3D" id="CylinderShape3D_tgirv"]
radius = 4.0
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_251sn"]
random_pitch = 1.3
streams_count = 2
stream_0/stream = ExtResource("2_2so43")
stream_1/stream = ExtResource("3_lkqw0")
[node name="Ring" type="CSGTorus3D"]
use_collision = true
inner_radius = 4.0
outer_radius = 8.0
sides = 16
ring_sides = 8
material = ExtResource("1_48h5f")
script = SubResource("GDScript_86vhg")
[node name="Area3D" type="Area3D" parent="."]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"]
shape = SubResource("CylinderShape3D_tgirv")
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = SubResource("AudioStreamRandomizer_251sn")
[connection signal="body_entered" from="Area3D" to="." method="_on_area_3d_body_entered"]