aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/audio/play_random.gd41
-rw-r--r--client/menu/credits_menu.gd7
-rw-r--r--client/player/character/character.gd7
-rw-r--r--client/player/character/character.tscn21
-rw-r--r--client/player/sounds/step1.oggbin0 -> 4852 bytes
-rw-r--r--client/player/sounds/step1.ogg.import19
-rw-r--r--client/player/sounds/step2.oggbin0 -> 4713 bytes
-rw-r--r--client/player/sounds/step2.ogg.import19
-rw-r--r--client/player/sounds/step3.oggbin0 -> 4624 bytes
-rw-r--r--client/player/sounds/step3.ogg.import19
10 files changed, 129 insertions, 4 deletions
diff --git a/client/audio/play_random.gd b/client/audio/play_random.gd
new file mode 100644
index 00000000..1efced30
--- /dev/null
+++ b/client/audio/play_random.gd
@@ -0,0 +1,41 @@
+# Undercooked - a game about cooking
+# Copyright 2024 tpart
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, version 3 of the License only.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+extends Node
+class_name PlayRandom
+
+@onready var sounds = get_children()
+
+var autoplay := false
+
+func _ready():
+ for s in sounds:
+ s.connect("finished", sound_finished)
+
+func play_random():
+ var s = sounds[randi_range(0, sounds.size() - 1)]
+ s.pitch_scale = randf_range(0.9, 1.1)
+ s.play()
+
+func start_autoplay():
+ autoplay = true
+ play_random()
+
+func stop_autoplay():
+ autoplay = false
+
+func sound_finished():
+ if autoplay:
+ play_random()
diff --git a/client/menu/credits_menu.gd b/client/menu/credits_menu.gd
index 59e7bab9..86a4443f 100644
--- a/client/menu/credits_menu.gd
+++ b/client/menu/credits_menu.gd
@@ -1,5 +1,5 @@
# Undercooked - a game about cooking
-# Copyright 2024 metamuffin
+# Copyright 2024 metamuffin, tpart
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
@@ -21,9 +21,10 @@ var cc_by_3 := {
"Glasses": "Jeremy Edelblut"
}
var cc_by_4 := {
- "Universal UI/Menu Soundpack": "Ellr",
+ "Footstep sounds": "Dryoma",
+ "Page_Turn_24.wav": "Koops",
"Pencil, Writing, Close, A.wav": "InspectorJ",
- "Page_Turn_24.wav": "Koops"
+ "Universal UI/Menu Soundpack": "Ellr"
}
@onready var menu_manager: MenuManager = get_parent()
diff --git a/client/player/character/character.gd b/client/player/character/character.gd
index 36ff1323..385481cc 100644
--- a/client/player/character/character.gd
+++ b/client/player/character/character.gd
@@ -39,6 +39,8 @@ var current_animation := "idle"
"E. Parsley": $Main/Head/Hair3
}
+@onready var step_sounds: PlayRandom = $Steps
+
func _ready():
play_animation("idle")
@@ -81,6 +83,11 @@ func select_hairstyle(id: int):
func play_animation(name_: String):
current_animation = name_
hand_animations.play(name_)
+
+ if name_ == "walk":
+ step_sounds.start_autoplay()
+ else:
+ step_sounds.stop_autoplay()
func _on_hand_animations_animation_finished(_name):
hand_animations.play(current_animation)
diff --git a/client/player/character/character.tscn b/client/player/character/character.tscn
index e4a2af66..eb090b02 100644
--- a/client/player/character/character.tscn
+++ b/client/player/character/character.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=18 format=3 uid="uid://b3hhir2fvnunu"]
+[gd_scene load_steps=22 format=3 uid="uid://b3hhir2fvnunu"]
[ext_resource type="Script" path="res://player/character/character.gd" id="1_12lbh"]
[ext_resource type="ArrayMesh" uid="uid://bnmm01yjwultj" path="res://player/character/main.res" id="2_lxdbd"]
@@ -9,6 +9,10 @@
[ext_resource type="ArrayMesh" uid="uid://dx7jswwaesok4" path="res://player/character/hair_2.res" id="7_0551e"]
[ext_resource type="ArrayMesh" uid="uid://c2qnwt44x8ujl" path="res://player/character/tie.res" id="7_knv6q"]
[ext_resource type="ArrayMesh" uid="uid://c5qsthvtf3cta" path="res://player/character/hair_3.res" id="8_2bc5u"]
+[ext_resource type="AudioStream" uid="uid://b5qwlhus7serr" path="res://player/sounds/step1.ogg" id="10_qpd6x"]
+[ext_resource type="AudioStream" uid="uid://4b6ix4pkfxpj" path="res://player/sounds/step2.ogg" id="11_2dmo8"]
+[ext_resource type="AudioStream" uid="uid://ywlunfulmrc6" path="res://player/sounds/step3.ogg" id="12_bj5ue"]
+[ext_resource type="Script" path="res://audio/play_random.gd" id="14_3rb6x"]
[sub_resource type="Animation" id="Animation_tdhvg"]
length = 0.001
@@ -655,4 +659,19 @@ scale_amount_min = 0.5
scale_amount_max = 0.75
scale_amount_curve = SubResource("Curve_7ml8g")
+[node name="Steps" type="Node" parent="."]
+script = ExtResource("14_3rb6x")
+
+[node name="Step1" type="AudioStreamPlayer" parent="Steps"]
+stream = ExtResource("10_qpd6x")
+volume_db = -16.0
+
+[node name="Step2" type="AudioStreamPlayer" parent="Steps"]
+stream = ExtResource("11_2dmo8")
+volume_db = -16.0
+
+[node name="Step3" type="AudioStreamPlayer" parent="Steps"]
+stream = ExtResource("12_bj5ue")
+volume_db = -16.0
+
[connection signal="animation_finished" from="HandAnimations" to="." method="_on_hand_animations_animation_finished"]
diff --git a/client/player/sounds/step1.ogg b/client/player/sounds/step1.ogg
new file mode 100644
index 00000000..fee63a29
--- /dev/null
+++ b/client/player/sounds/step1.ogg
Binary files differ
diff --git a/client/player/sounds/step1.ogg.import b/client/player/sounds/step1.ogg.import
new file mode 100644
index 00000000..d992834c
--- /dev/null
+++ b/client/player/sounds/step1.ogg.import
@@ -0,0 +1,19 @@
+[remap]
+
+importer="oggvorbisstr"
+type="AudioStreamOggVorbis"
+uid="uid://b5qwlhus7serr"
+path="res://.godot/imported/step1.ogg-fb18c712af8c20437bc3716795beb323.oggvorbisstr"
+
+[deps]
+
+source_file="res://player/sounds/step1.ogg"
+dest_files=["res://.godot/imported/step1.ogg-fb18c712af8c20437bc3716795beb323.oggvorbisstr"]
+
+[params]
+
+loop=false
+loop_offset=0
+bpm=0
+beat_count=0
+bar_beats=4
diff --git a/client/player/sounds/step2.ogg b/client/player/sounds/step2.ogg
new file mode 100644
index 00000000..f043a70c
--- /dev/null
+++ b/client/player/sounds/step2.ogg
Binary files differ
diff --git a/client/player/sounds/step2.ogg.import b/client/player/sounds/step2.ogg.import
new file mode 100644
index 00000000..0cc05416
--- /dev/null
+++ b/client/player/sounds/step2.ogg.import
@@ -0,0 +1,19 @@
+[remap]
+
+importer="oggvorbisstr"
+type="AudioStreamOggVorbis"
+uid="uid://4b6ix4pkfxpj"
+path="res://.godot/imported/step2.ogg-cac7b3cbd2fc698c0ac3ca59fb818e5d.oggvorbisstr"
+
+[deps]
+
+source_file="res://player/sounds/step2.ogg"
+dest_files=["res://.godot/imported/step2.ogg-cac7b3cbd2fc698c0ac3ca59fb818e5d.oggvorbisstr"]
+
+[params]
+
+loop=false
+loop_offset=0
+bpm=0
+beat_count=0
+bar_beats=4
diff --git a/client/player/sounds/step3.ogg b/client/player/sounds/step3.ogg
new file mode 100644
index 00000000..7f2f9955
--- /dev/null
+++ b/client/player/sounds/step3.ogg
Binary files differ
diff --git a/client/player/sounds/step3.ogg.import b/client/player/sounds/step3.ogg.import
new file mode 100644
index 00000000..82db7301
--- /dev/null
+++ b/client/player/sounds/step3.ogg.import
@@ -0,0 +1,19 @@
+[remap]
+
+importer="oggvorbisstr"
+type="AudioStreamOggVorbis"
+uid="uid://ywlunfulmrc6"
+path="res://.godot/imported/step3.ogg-2d825d8675e6dad3253d34dfcabf3b0e.oggvorbisstr"
+
+[deps]
+
+source_file="res://player/sounds/step3.ogg"
+dest_files=["res://.godot/imported/step3.ogg-2d825d8675e6dad3253d34dfcabf3b0e.oggvorbisstr"]
+
+[params]
+
+loop=false
+loop_offset=0
+bpm=0
+beat_count=0
+bar_beats=4