DreamBall/elements/ring.tscn

50 lines
1.6 KiB
Text
Raw Normal View History

2025-02-22 19:46:19 +01:00
[gd_scene load_steps=7 format=3 uid="uid://cpm3laywhlbq5"]
2025-02-23 00:46:23 +01:00
[ext_resource type="Material" uid="uid://brwwlwb1rpro7" path="res://graphics/unhappy_material.tres" id="1_48h5f"]
2025-02-22 19:46:19 +01:00
[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"]
2025-02-22 17:16:30 +01:00
[sub_resource type="GDScript" id="GDScript_86vhg"]
script/source = "extends CSGTorus3D
2025-02-22 19:46:19 +01:00
var happy_material = preload(\"res://graphics/happy_material.tres\")
2025-02-22 17:16:30 +01:00
var collected = false
2025-02-23 00:46:23 +01:00
signal collect_signal
2025-02-22 17:16:30 +01:00
func _on_area_3d_body_entered(body: Node3D) -> void:
if collected == false and body.name == \"Sphere\":
2025-02-22 19:46:19 +01:00
self.material = happy_material
2025-02-22 17:16:30 +01:00
collected = true
2025-02-22 19:46:19 +01:00
$AudioStreamPlayer.play()
2025-02-23 00:46:23 +01:00
collect_signal.emit()
2025-02-22 17:16:30 +01:00
"
[sub_resource type="CylinderShape3D" id="CylinderShape3D_tgirv"]
radius = 4.0
2025-02-22 19:46:19 +01:00
[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")
2025-02-22 17:16:30 +01:00
[node name="Ring" type="CSGTorus3D"]
use_collision = true
inner_radius = 4.0
outer_radius = 8.0
2025-03-25 13:39:03 +01:00
sides = 32
ring_sides = 16
2025-02-22 19:46:19 +01:00
material = ExtResource("1_48h5f")
2025-02-22 17:16:30 +01:00
script = SubResource("GDScript_86vhg")
[node name="Area3D" type="Area3D" parent="."]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"]
shape = SubResource("CylinderShape3D_tgirv")
2025-02-22 19:46:19 +01:00
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = SubResource("AudioStreamRandomizer_251sn")
2025-02-22 17:16:30 +01:00
[connection signal="body_entered" from="Area3D" to="." method="_on_area_3d_body_entered"]