Add sound effects

This commit is contained in:
Marvin Dalheimer 2024-01-28 15:16:29 +01:00
parent 0abd197c18
commit ce13530dfa
Signed by: Rinma
GPG Key ID: 44CAD3A9F1679D8D
19 changed files with 577 additions and 163 deletions

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://0k6ujfaq7msw"
path="res://.godot/imported/buh_1.wav-e92be9823514555c18a1d85000eb7b5f.sample"
[deps]
source_file="res://audio/buh_1.wav"
dest_files=["res://.godot/imported/buh_1.wav-e92be9823514555c18a1d85000eb7b5f.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=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://dwsveuqk75ael"
path="res://.godot/imported/buh_2.wav-3265de19d1ec12c358a8b7076a834489.sample"
[deps]
source_file="res://audio/buh_2.wav"
dest_files=["res://.godot/imported/buh_2.wav-3265de19d1ec12c358a8b7076a834489.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=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://fkwgly1jeqro"
path="res://.godot/imported/buh_3.wav-a51f4eb5ec7d0e39beb5b09148160404.sample"
[deps]
source_file="res://audio/buh_3.wav"
dest_files=["res://.godot/imported/buh_3.wav-a51f4eb5ec7d0e39beb5b09148160404.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=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://d1y3npku40ufd"
path="res://.godot/imported/buh_4.wav-051f93dfac6f5affe4111e95b81d366c.sample"
[deps]
source_file="res://audio/buh_4.wav"
dest_files=["res://.godot/imported/buh_4.wav-051f93dfac6f5affe4111e95b81d366c.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=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://dxe2412gbht5x"
path="res://.godot/imported/cough_1.wav-64464c03d6559b420ee1e171b477560b.sample"
[deps]
source_file="res://audio/cough_1.wav"
dest_files=["res://.godot/imported/cough_1.wav-64464c03d6559b420ee1e171b477560b.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=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://04yaek8c54sk"
path="res://.godot/imported/cough_2.wav-479f12d101d6cd1066d489e83754c964.sample"
[deps]
source_file="res://audio/cough_2.wav"
dest_files=["res://.godot/imported/cough_2.wav-479f12d101d6cd1066d489e83754c964.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=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://b0q3boyn1ivpk"
path="res://.godot/imported/cough_3.wav-9f6c98fa25daeb2d797c7b6d2d749f18.sample"
[deps]
source_file="res://audio/cough_3.wav"
dest_files=["res://.godot/imported/cough_3.wav-9f6c98fa25daeb2d797c7b6d2d749f18.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=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://dirqt4slkf2qi"
path="res://.godot/imported/haha_1.wav-9427e5608055932c293e9ac065da8228.sample"
[deps]
source_file="res://audio/haha_1.wav"
dest_files=["res://.godot/imported/haha_1.wav-9427e5608055932c293e9ac065da8228.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=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://bugi8raxy604q"
path="res://.godot/imported/haha_2.wav-ff41bdcb14ad06c10f2d09031e08b6f4.sample"
[deps]
source_file="res://audio/haha_2.wav"
dest_files=["res://.godot/imported/haha_2.wav-ff41bdcb14ad06c10f2d09031e08b6f4.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=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://do3t0b6nmai2x"
path="res://.godot/imported/haha_3.wav-21ca331f9acd246b9e4c523efb31e6c1.sample"
[deps]
source_file="res://audio/haha_3.wav"
dest_files=["res://.godot/imported/haha_3.wav-21ca331f9acd246b9e4c523efb31e6c1.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=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://cnqxqkbvuttdm"
path="res://.godot/imported/haha_4.wav-42bc10d85a404b6f4a5abe9a7f7baf0b.sample"
[deps]
source_file="res://audio/haha_4.wav"
dest_files=["res://.godot/imported/haha_4.wav-42bc10d85a404b6f4a5abe9a7f7baf0b.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=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://uml0racw45mf"
path="res://.godot/imported/tim_blabla_1.wav-4f25400e13b50e69afd6ea760e82c8bb.sample"
[deps]
source_file="res://audio/tim_blabla_1.wav"
dest_files=["res://.godot/imported/tim_blabla_1.wav-4f25400e13b50e69afd6ea760e82c8bb.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=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://b8vih1eklq0xs"
path="res://.godot/imported/tim_blabla_2.wav-bceb510a368831dc11e03222487328db.sample"
[deps]
source_file="res://audio/tim_blabla_2.wav"
dest_files=["res://.godot/imported/tim_blabla_2.wav-bceb510a368831dc11e03222487328db.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=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://d2ka2b15l2us"
path="res://.godot/imported/tim_blabla_3.wav-f7541f158e8afa9614fb099b23f606b9.sample"
[deps]
source_file="res://audio/tim_blabla_3.wav"
dest_files=["res://.godot/imported/tim_blabla_3.wav-f7541f158e8afa9614fb099b23f606b9.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=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://7nx6sepgu4w0"
path="res://.godot/imported/tim_blabla_4.wav-9d46330c2047d4f4fe7de99a4c161e6f.sample"
[deps]
source_file="res://audio/tim_blabla_4.wav"
dest_files=["res://.godot/imported/tim_blabla_4.wav-9d46330c2047d4f4fe7de99a4c161e6f.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=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View File

@ -11,6 +11,13 @@ var default_texture: Texture2D = load("res://sprites/tim_side.png")
var ducking_texture: Texture2D = load("res://sprites/tim_ducking.svg") var ducking_texture: Texture2D = load("res://sprites/tim_ducking.svg")
var last_joke: Joke var last_joke: Joke
var blabla_sounds = [
preload("res://audio/tim_blabla_1.wav"),
preload("res://audio/tim_blabla_2.wav"),
preload("res://audio/tim_blabla_3.wav"),
preload("res://audio/tim_blabla_4.wav")
]
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
Signals.hit_tim.connect(ouch) Signals.hit_tim.connect(ouch)
@ -46,6 +53,8 @@ func _on_joke_button_button_pressed(joke: Joke):
_disable_buttons() _disable_buttons()
_start_joke_for_audience() _start_joke_for_audience()
$AnimationPlayer.play("talking") $AnimationPlayer.play("talking")
$Speaker.stream = blabla_sounds[randi() % blabla_sounds.size()]
$Speaker.play()
func _get_targeted_audience_members(target_all: bool): func _get_targeted_audience_members(target_all: bool):
if target_all: if target_all:

View File

@ -44,6 +44,26 @@ var known_bodies = {
], ],
} }
var buh_sounds = [
preload("res://audio/buh_1.wav"),
preload("res://audio/buh_2.wav"),
preload("res://audio/buh_3.wav"),
preload("res://audio/buh_4.wav"),
]
var laugh_sounds = [
preload("res://audio/haha_1.wav"),
preload("res://audio/haha_2.wav"),
preload("res://audio/haha_3.wav"),
preload("res://audio/haha_4.wav"),
]
var cough_sounds = [
preload("res://audio/cough_1.wav"),
preload("res://audio/cough_2.wav"),
preload("res://audio/cough_3.wav"),
]
const laughter_duration : float = 2. # seconds const laughter_duration : float = 2. # seconds
const laughter_bobs : int = 4 const laughter_bobs : int = 4
var laughter_left : float = 0. var laughter_left : float = 0.
@ -62,6 +82,15 @@ static func get_random_color():
var keys = ["blue", "green", "red"] var keys = ["blue", "green", "red"]
return keys[randi() % keys.size()] return keys[randi() % keys.size()]
func get_random_cough():
return cough_sounds[randi() % cough_sounds.size()]
func get_random_buh():
return buh_sounds[randi() % buh_sounds.size()]
func get_random_laugh():
return laugh_sounds[randi() % laugh_sounds.size()]
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
laughter_left = 0. laughter_left = 0.
@ -108,6 +137,10 @@ func update_mood(change: float):
# bob head # bob head
var tween = get_tree().create_tween().bind_node(self).set_loops(laughter_bobs) var tween = get_tree().create_tween().bind_node(self).set_loops(laughter_bobs)
var bob_duration = laughter_duration / laughter_bobs / 2 var bob_duration = laughter_duration / laughter_bobs / 2
$Speaker.stream = get_random_laugh()
$Speaker.play()
tween.tween_property(face, "position", Vector2.UP * 20, bob_duration).set_delay(randf_range(0, bob_duration)) tween.tween_property(face, "position", Vector2.UP * 20, bob_duration).set_delay(randf_range(0, bob_duration))
tween.tween_property(face, "position", Vector2.ZERO, bob_duration) tween.tween_property(face, "position", Vector2.ZERO, bob_duration)
@ -123,6 +156,10 @@ func update_expression():
else: else:
expression = "neutral" expression = "neutral"
if randi() % 25000 == 1:
$Speaker.stream = get_random_cough()
$Speaker.play()
func set_random_body(for_color): func set_random_body(for_color):
if str(for_color) not in known_bodies: if str(for_color) not in known_bodies:
var keys = known_bodies.keys() var keys = known_bodies.keys()
@ -154,6 +191,9 @@ func on_joke_finish():
func throw_bottle(): func throw_bottle():
mood += 2.0 mood += 2.0
$Speaker.stream = get_random_buh()
$Speaker.play()
var bottle_scene = preload("res://scenes/objects/bottle.tscn") var bottle_scene = preload("res://scenes/objects/bottle.tscn")
var bottle = bottle_scene.instantiate() var bottle = bottle_scene.instantiate()

View File

@ -27,3 +27,6 @@ shape = SubResource("RectangleShape2D_5rd5b")
[node name="Profile" type="Node2D" parent="."] [node name="Profile" type="Node2D" parent="."]
script = ExtResource("2_bsodr") script = ExtResource("2_bsodr")
[node name="Speaker" type="AudioStreamPlayer2D" parent="."]
bus = &"Sound"

View File

@ -141,6 +141,8 @@ libraries = {
"": SubResource("AnimationLibrary_xvfym") "": SubResource("AnimationLibrary_xvfym")
} }
[node name="Speaker" type="AudioStreamPlayer2D" parent="Tim"]
[node name="Boundary" type="Node2D" parent="."] [node name="Boundary" type="Node2D" parent="."]
script = ExtResource("2_8p6ir") script = ExtResource("2_8p6ir")
width = 400.0 width = 400.0