Skip to content

Commit 60a3fdc

Browse files
russell-cjwjtmanuq
authored
Add SFX for FragileBarrel (#1697)
This implements audio for the FragileBarrel mechanic. * Added `cracks` and `breaking` sound effects assets. * Used `AudioStreamRandomizer` with a 1.1 pitch variation to prevent repetition. * Updated `FragileBarrel` script and scene to trigger sounds on damage and destruction. Resolves #1647 --------- Co-authored-by: Will Thompson <[email protected]> Co-authored-by: Manuel Quiñones <[email protected]>
1 parent e6a1577 commit 60a3fdc

File tree

10 files changed

+84
-8
lines changed

10 files changed

+84
-8
lines changed
Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
1-
[gd_scene load_steps=4 format=3 uid="uid://lea3l0ewp5fr"]
1+
[gd_scene load_steps=6 format=3 uid="uid://lea3l0ewp5fr"]
22

33
[ext_resource type="PackedScene" uid="uid://y8ha8abfyap2" path="res://scenes/game_elements/props/filling_barrel/filling_barrel.tscn" id="1_ab25j"]
44
[ext_resource type="SpriteFrames" uid="uid://ch0p31t4upx7w" path="res://scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/barrel_cracks/barrel_cracks.tres" id="2_g6wko"]
55
[ext_resource type="Script" uid="uid://d05hp7ascndlr" path="res://scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/fragile_barrel.gd" id="2_wal8y"]
6+
[ext_resource type="AudioStream" uid="uid://bknpb07lvbded" path="res://scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/sounds/sfx_barrel_crack.tres" id="4_sdj6j"]
7+
[ext_resource type="AudioStream" uid="uid://c3iuv5ax8i78v" path="res://scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/sounds/sfx_barrel_breaking.tres" id="5_v7k7g"]
68

79
[node name="FragileBarrel" instance=ExtResource("1_ab25j")]
810
script = ExtResource("2_wal8y")
911
max_health = 4
1012

11-
[node name="AnimatedSprite2D" parent="." index="0"]
12-
animation = &"filling"
13-
frame = 0
14-
frame_progress = 0.0
15-
1613
[node name="CrackOverlay" type="AnimatedSprite2D" parent="." index="1"]
1714
unique_name_in_owner = true
1815
visible = false
1916
position = Vector2(0, -21)
2017
sprite_frames = ExtResource("2_g6wko")
18+
19+
[node name="CrackSound" type="AudioStreamPlayer2D" parent="." index="6"]
20+
unique_name_in_owner = true
21+
stream = ExtResource("4_sdj6j")
22+
23+
[node name="ShatterSound" type="AudioStreamPlayer2D" parent="." index="7"]
24+
unique_name_in_owner = true
25+
stream = ExtResource("5_v7k7g")

scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/fragile_barrel.gd

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ signal barrel_destroyed(barrel_instance: FragileBarrel)
1313
var current_health: int
1414

1515
@onready var crack_overlay_node: AnimatedSprite2D = %CrackOverlay
16+
@onready var crack_sound: AudioStreamPlayer2D = %CrackSound
17+
@onready var shatter_sound: AudioStreamPlayer2D = %ShatterSound
1618

1719

1820
func _ready() -> void:
1921
super._ready()
2022
current_health = max_health
21-
2223
crack_overlay_node.visible = false
23-
# Redundant stop() and frame reset removed as per code review
2424

2525

2626
# Logic called by Projectile when it hits this object
@@ -41,6 +41,7 @@ func take_damage() -> void:
4141
if current_health <= 0:
4242
break_barrel()
4343
else:
44+
crack_sound.play()
4445
update_cracks()
4546

4647

@@ -61,6 +62,8 @@ func update_cracks() -> void:
6162
func break_barrel() -> void:
6263
crack_overlay_node.visible = false
6364

65+
shatter_sound.play()
66+
6467
# Play destruction animation directly
6568
animated_sprite_2d.play("shatter")
6669
await animated_sprite_2d.animation_finished
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:0629705311cb9b3693971f95358205242b2b4b33da6cbb9c343c6e639021dd43
3+
size 14224
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[remap]
2+
3+
importer="oggvorbisstr"
4+
type="AudioStreamOggVorbis"
5+
uid="uid://d3d5cwdkgapw"
6+
path="res://.godot/imported/breaking.ogg-1791aca212f477220393863335804d06.oggvorbisstr"
7+
8+
[deps]
9+
10+
source_file="res://scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/sounds/breaking.ogg"
11+
dest_files=["res://.godot/imported/breaking.ogg-1791aca212f477220393863335804d06.oggvorbisstr"]
12+
13+
[params]
14+
15+
loop=false
16+
loop_offset=0
17+
bpm=0
18+
beat_count=0
19+
bar_beats=4
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SPDX-License-Identifier: CC0-1.0
2+
SPDX-FileCopyrightText: 2021 Fission9
3+
4+
Tile Breaking by Fission9 -- https://freesound.org/s/583310/
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:78b58808761de9a09af0899f1196fad7e516e0b4470952c5cd0f7d7c510441df
3+
size 15040
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[remap]
2+
3+
importer="oggvorbisstr"
4+
type="AudioStreamOggVorbis"
5+
uid="uid://j2pkrpimameb"
6+
path="res://.godot/imported/cracks.ogg-bcebe2c454e85910fbe1abd50c8980cf.oggvorbisstr"
7+
8+
[deps]
9+
10+
source_file="res://scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/sounds/cracks.ogg"
11+
dest_files=["res://.godot/imported/cracks.ogg-bcebe2c454e85910fbe1abd50c8980cf.oggvorbisstr"]
12+
13+
[params]
14+
15+
loop=false
16+
loop_offset=0
17+
bpm=0
18+
beat_count=0
19+
bar_beats=4
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SPDX-FileCopyrightText: 2020 max2587
2+
SPDX-License-Identifier: CC-BY-4.0
3+
4+
glass 2.wav by max2587 -- https://freesound.org/s/548232/
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[gd_resource type="AudioStreamRandomizer" load_steps=2 format=3 uid="uid://c3iuv5ax8i78v"]
2+
3+
[ext_resource type="AudioStream" uid="uid://d3d5cwdkgapw" path="res://scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/sounds/breaking.ogg" id="1_kfwyl"]
4+
5+
[resource]
6+
random_pitch = 1.1
7+
streams_count = 1
8+
stream_0/stream = ExtResource("1_kfwyl")
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[gd_resource type="AudioStreamRandomizer" load_steps=2 format=3 uid="uid://bknpb07lvbded"]
2+
3+
[ext_resource type="AudioStream" uid="uid://j2pkrpimameb" path="res://scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/sounds/cracks.ogg" id="1_2auby"]
4+
5+
[resource]
6+
random_pitch = 1.1
7+
streams_count = 1
8+
stream_0/stream = ExtResource("1_2auby")

0 commit comments

Comments
 (0)