feat: added explosion sounds
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -83,5 +83,6 @@ func _spawn_custom_projectile(origin: Vector3, fire_dir: Vector3) -> void:
|
||||
proj.falloff_curve = 2.0 # Steep dropoff: "Should be an instant kill in closest 50%"
|
||||
# (0-50% = dist<6. 6/12 = 0.5. 1.0 - 0.5^2 = 0.75 multiplier. 200 * 0.75 = 150 damage -> 1 shot kill)
|
||||
proj.can_self_damage = true # Can self damage
|
||||
proj.explosion_pitch = 0.4 # Deepest explosion
|
||||
|
||||
get_tree().current_scene.add_child(proj)
|
||||
|
||||
@@ -103,5 +103,6 @@ func _spawn_custom_projectile(origin: Vector3, fire_dir: Vector3) -> void:
|
||||
proj.explosion_radius = 4.0 # Moderate AoE
|
||||
proj.explosion_knockback = 45.0 # Strong knockback!
|
||||
proj.can_self_damage = false # As requested
|
||||
proj.explosion_pitch = 0.7 # Fairly deep
|
||||
|
||||
get_tree().current_scene.add_child(proj)
|
||||
|
||||
@@ -189,5 +189,6 @@ func _spawn_custom_projectile(origin: Vector3, fire_dir: Vector3) -> void:
|
||||
proj.explosion_radius = 1.5 # Tiny AoE effect
|
||||
proj.explosion_knockback = 5.0
|
||||
proj.can_self_damage = false
|
||||
proj.explosion_pitch = 1.2 # Less deep but still explosion
|
||||
|
||||
get_tree().current_scene.add_child(proj)
|
||||
|
||||
Reference in New Issue
Block a user