feat: added explosion sounds

This commit is contained in:
DottsGit
2026-06-06 01:42:15 -04:00
parent a6f5f24420
commit 8118100a95
4 changed files with 15 additions and 0 deletions
+12
View File
@@ -5,6 +5,7 @@ var explosion_radius: float = 2.5
var explosion_knockback: float = 20.0
var can_self_damage: bool = false
var falloff_curve: float = 1.0 # 1.0 is linear, 2.0 is quadratic (steep drop)
var explosion_pitch: float = 1.0 # Audio pitch for explosion
var flight_sound: AudioStreamPlayer3D
var smoke_sys: GPUParticles3D
var jet_sys: GPUParticles3D
@@ -221,3 +222,14 @@ func _explode(pos: Vector3) -> void:
tween.tween_property(mat, "albedo_color:a", 0.0, 0.3)
tween.parallel().tween_property(visual, "scale", Vector3(1.1, 1.1, 1.1), 0.3)
tween.tween_callback(visual.queue_free)
# Audio Effect
var audio = AudioStreamPlayer3D.new()
audio.stream = load("res://assets/sounds/shotgun_fire.wav") # using shotgun fire for a crash explosion
audio.bus = "SFX"
audio.pitch_scale = explosion_pitch
audio.max_distance = 150.0
get_tree().current_scene.add_child(audio)
audio.global_position = pos
audio.play()
audio.finished.connect(audio.queue_free)