Browse Source

Add chocolate pickup sound

DricomDragon 4 months ago
parent
commit
67568df793

+ 2 - 0
godot/component/entity/collectibles/chocolate/chocolate.gd

@@ -5,6 +5,7 @@ extends Node3D
 const COLLECT_ANIM := "collection"
 
 @onready var chocolateAnimation: AnimationPlayer = $ChocolateAnimation
+@onready var pickupSound: AudioStreamPlayer3D = $ChocolatePickupSound
 
 var _collected := false
 
@@ -23,6 +24,7 @@ func _give_chocolate_to(walker: Walker) -> void:
 	reparent(walker)
 	chocolateAnimation.play(COLLECT_ANIM)
 	chocolateAnimation.animation_finished.connect(_finish)
+	pickupSound.play()
 
 
 func _finish(animation_name: String) -> void:

+ 25 - 22
godot/component/entity/collectibles/chocolate/chocolate.tscn

@@ -1,26 +1,7 @@
-[gd_scene load_steps=11 format=3 uid="uid://ba3gf7iy3mxbq"]
+[gd_scene load_steps=12 format=3 uid="uid://ba3gf7iy3mxbq"]
 
 [ext_resource type="Script" path="res://component/entity/collectibles/chocolate/chocolate.gd" id="1_wk24q"]
-
-[sub_resource type="Animation" id="Animation_0f754"]
-resource_name = "idle"
-length = 4.0
-loop_mode = 1
-step = 1.0
-tracks/0/type = "rotation_3d"
-tracks/0/imported = false
-tracks/0/enabled = true
-tracks/0/path = NodePath(".")
-tracks/0/interp = 1
-tracks/0/loop_wrap = true
-tracks/0/keys = PackedFloat32Array(0, 1, 0, 0, 0, 1, 2, 1, 0, 1, 0, 0, 4, 1, 0, 0, 0, -1)
-tracks/1/type = "position_3d"
-tracks/1/imported = false
-tracks/1/enabled = true
-tracks/1/path = NodePath(".")
-tracks/1/interp = 2
-tracks/1/loop_wrap = true
-tracks/1/keys = PackedFloat32Array(0, 1, 0, 0, 0, 2, 1, 0, 0.25, 0)
+[ext_resource type="AudioStream" uid="uid://h5pmhfnb4wus" path="res://component/entity/collectibles/chocolate/pickupChocolate.wav" id="2_ecvab"]
 
 [sub_resource type="Animation" id="Animation_cfly2"]
 length = 0.001
@@ -58,6 +39,26 @@ tracks/2/interp = 2
 tracks/2/loop_wrap = true
 tracks/2/keys = PackedFloat32Array(0, 1, 0, 0, 0, 1, 1, 0, 1.5, 0, 2, 1, 0, 0, 0)
 
+[sub_resource type="Animation" id="Animation_0f754"]
+resource_name = "idle"
+length = 4.0
+loop_mode = 1
+step = 1.0
+tracks/0/type = "rotation_3d"
+tracks/0/imported = false
+tracks/0/enabled = true
+tracks/0/path = NodePath(".")
+tracks/0/interp = 1
+tracks/0/loop_wrap = true
+tracks/0/keys = PackedFloat32Array(0, 1, 0, 0, 0, 1, 2, 1, 0, 1, 0, 0, 4, 1, 0, 0, 0, -1)
+tracks/1/type = "position_3d"
+tracks/1/imported = false
+tracks/1/enabled = true
+tracks/1/path = NodePath(".")
+tracks/1/interp = 2
+tracks/1/loop_wrap = true
+tracks/1/keys = PackedFloat32Array(0, 1, 0, 0, 0, 2, 1, 0, 0.25, 0)
+
 [sub_resource type="AnimationLibrary" id="AnimationLibrary_djjxd"]
 _data = {
 "RESET": SubResource("Animation_cfly2"),
@@ -95,7 +96,6 @@ libraries = {
 autoplay = "idle"
 
 [node name="ChocolateTablet" type="Area3D" parent="."]
-transform = Transform3D(0.00300002, 0, 0, 0, 0.00300002, 0, 0, 0, 0.00300002, 0, 0, 0)
 collision_layer = 32
 collision_mask = 10
 
@@ -110,4 +110,7 @@ mesh = SubResource("BoxMesh_c10ab")
 transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.119209, 0)
 mesh = SubResource("BoxMesh_ialpe")
 
+[node name="ChocolatePickupSound" type="AudioStreamPlayer3D" parent="."]
+stream = ExtResource("2_ecvab")
+
 [connection signal="body_entered" from="ChocolateTablet" to="." method="_on_chocolate_tablet_body_entered"]

BIN
godot/component/entity/collectibles/chocolate/pickupChocolate.wav


+ 24 - 0
godot/component/entity/collectibles/chocolate/pickupChocolate.wav.import

@@ -0,0 +1,24 @@
+[remap]
+
+importer="wav"
+type="AudioStreamWAV"
+uid="uid://h5pmhfnb4wus"
+path="res://.godot/imported/pickupChocolate.wav-8e1f4ed4c4e77a50fca685d7f9084c9f.sample"
+
+[deps]
+
+source_file="res://component/entity/collectibles/chocolate/pickupChocolate.wav"
+dest_files=["res://.godot/imported/pickupChocolate.wav-8e1f4ed4c4e77a50fca685d7f9084c9f.sample"]
+
+[params]
+
+force/8_bit=false
+force/mono=false
+force/max_rate=false
+force/max_rate_hz=44100
+edit/trim=false
+edit/normalize=false
+edit/loop_mode=1
+edit/loop_begin=0
+edit/loop_end=-1
+compress/mode=0