Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions scenes/game_elements/props/filling_barrel/fragile_barrel.tscn
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
[gd_scene load_steps=4 format=3 uid="uid://lea3l0ewp5fr"]
[gd_scene load_steps=6 format=3 uid="uid://lea3l0ewp5fr"]

[ext_resource type="PackedScene" uid="uid://y8ha8abfyap2" path="res://scenes/game_elements/props/filling_barrel/filling_barrel.tscn" id="1_ab25j"]
[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"]
[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"]
[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"]
[ext_resource type="AudioStream" uid="uid://c3iuv5ax8i78v" path="res://scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/sounds/stx_fragile_barrel.tres" id="5_v7k7g"]

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

[node name="AnimatedSprite2D" parent="." index="0"]
animation = &"filling"
frame = 0
frame_progress = 0.0

[node name="CrackOverlay" type="AnimatedSprite2D" parent="." index="1"]
unique_name_in_owner = true
visible = false
position = Vector2(0, -21)
sprite_frames = ExtResource("2_g6wko")

[node name="CrackSound" type="AudioStreamPlayer2D" parent="." index="6"]
unique_name_in_owner = true
stream = ExtResource("4_sdj6j")

[node name="ShatterSound" type="AudioStreamPlayer2D" parent="." index="7"]
unique_name_in_owner = true
stream = ExtResource("5_v7k7g")
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ signal barrel_destroyed(barrel_instance: FragileBarrel)
var current_health: int

@onready var crack_overlay_node: AnimatedSprite2D = %CrackOverlay
@onready var crack_sound: AudioStreamPlayer2D = %CrackSound
@onready var shatter_sound: AudioStreamPlayer2D = %ShatterSound


func _ready() -> void:
super._ready()
current_health = max_health

crack_overlay_node.visible = false
# Redundant stop() and frame reset removed as per code review


# Logic called by Projectile when it hits this object
Expand All @@ -41,6 +41,7 @@ func take_damage() -> void:
if current_health <= 0:
break_barrel()
else:
crack_sound.play()
update_cracks()


Expand All @@ -61,6 +62,9 @@ func update_cracks() -> void:
func break_barrel() -> void:
crack_overlay_node.visible = false

if shatter_sound:
shatter_sound.play()

# Play destruction animation directly
animated_sprite_2d.play("shatter")
await animated_sprite_2d.animation_finished
Expand Down
Git LFS file not shown
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[remap]

importer="wav"
type="AudioStreamWAV"
uid="uid://74b6dlm4xhr"
path="res://.godot/imported/breaking.wav-2a0d2c03a8c9870e5f1d02e89419b03e.sample"

[deps]

source_file="res://scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/sounds/breaking.wav"
dest_files=["res://.godot/imported/breaking.wav-2a0d2c03a8c9870e5f1d02e89419b03e.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=2
Git LFS file not shown
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[remap]

importer="wav"
type="AudioStreamWAV"
uid="uid://d5vex7h5qsrs"
path="res://.godot/imported/cracks.wav-0c69782aaa1346b112673f8be862343d.sample"

[deps]

source_file="res://scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/sounds/cracks.wav"
dest_files=["res://.godot/imported/cracks.wav-0c69782aaa1346b112673f8be862343d.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=2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[gd_resource type="AudioStreamRandomizer" load_steps=2 format=3 uid="uid://bknpb07lvbded"]

[ext_resource type="AudioStream" uid="uid://d5vex7h5qsrs" path="res://scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/sounds/cracks.wav" id="1_2auby"]

[resource]
random_pitch = 1.1
streams_count = 1
stream_0/stream = ExtResource("1_2auby")
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[gd_resource type="AudioStreamRandomizer" load_steps=2 format=3 uid="uid://c3iuv5ax8i78v"]

[ext_resource type="AudioStream" uid="uid://74b6dlm4xhr" path="res://scenes/quests/lore_quests/quest_003/2_ink_drinker_levels/components/sounds/breaking.wav" id="1_kfwyl"]

[resource]
random_pitch = 1.1
streams_count = 1
stream_0/stream = ExtResource("1_kfwyl")