police siren and engine sfx

This commit is contained in:
Michael Campbell 2026-04-16 02:52:45 -04:00
parent 7d4a6938dc
commit d93aa1e31a
17 changed files with 165 additions and 4 deletions

15
default_bus_layout.tres Normal file
View file

@ -0,0 +1,15 @@
[gd_resource type="AudioBusLayout" format=3 uid="uid://bnw08msjouhf6"]
[sub_resource type="AudioEffectLimiter" id="AudioEffectLimiter_j3pel"]
resource_name = "Limiter"
ceiling_db = -14.3
[resource]
bus/1/name = &"Police Siren"
bus/1/solo = false
bus/1/mute = false
bus/1/bypass_fx = false
bus/1/volume_db = 0.0
bus/1/send = &"Master"
bus/1/effect/0/effect = SubResource("AudioEffectLimiter_j3pel")
bus/1/effect/0/enabled = true

View file

@ -1,6 +1,7 @@
[gd_scene format=3 uid="uid://oyqyvj5xo5mf"]
[ext_resource type="Script" uid="uid://c6xr2j0g1ep7j" path="res://enemies/enemy.gd" id="1_j7qyq"]
[ext_resource type="AudioStream" uid="uid://q8b6o255ofgb" path="res://sfx/police-siren_90bpm_A#_major.wav" id="2_bfj6p"]
[sub_resource type="Curve" id="Curve_spw8y"]
_limits = [1.0, 20.0, -1.0, 1.0]
@ -20,4 +21,11 @@ unique_name_in_owner = true
collision_layer = 0
collision_mask = 2
[node name="Siren" type="AudioStreamPlayer3D" parent="." unique_id=2085366724]
unique_name_in_owner = true
stream = ExtResource("2_bfj6p")
autoplay = true
max_distance = 50.0
bus = &"Police Siren"
[connection signal="body_entered" from="Hurtbox" to="." method="_on_hurtbox_body_entered"]

View file

@ -56,13 +56,31 @@ func _process(delta: float) -> void:
move_and_slide()
func kill() -> void:
queue_free()
var siren: AudioStreamPlayer3D = %Siren
siren.reparent(get_tree().current_scene)
var t := siren.create_tween()
if randf() < .25:
t.tween_property(siren, "pitch_scale", .25, .5)
t.tween_property(siren, "pitch_scale", .35, .25)
t.tween_property(siren, "pitch_scale", .0, .25)
else:
t.tween_property(siren, "pitch_scale", .0, .5)
t.finished.connect(siren.queue_free)
SignalBus.enemy_destroyed.emit()
func hit(proj: Node3D, damage: float) -> bool:
if invulnerable: return true
health -= damage
if health <= 0:
queue_free()
SignalBus.enemy_destroyed.emit()
kill()
else:
if proj is PlayerProjectile:
knockback = proj.velocity * 2. * knockback_mul * proj.knockback_mul

View file

@ -26,7 +26,7 @@ func hit(proj: Node3D, _damage: float) -> bool:
label_vfx.position = parent.position
parent.add_sibling(label_vfx)
parent.queue_free()
parent.kill()
SignalBus.perfect_shot_hit.emit()

View file

@ -3,6 +3,7 @@ extends Node
@export var time_scale := 1.:
set(v):
Engine.time_scale = v
AudioServer.playback_speed_scale = v
func _ready() -> void:
time_scale = time_scale

View file

@ -58,6 +58,9 @@ func _init() -> void:
func _ready() -> void:
health = health
await get_tree().process_frame
Level.level.level_started.connect(func(): %EngineSFX.play())
func _process_stamina(delta: float) -> void:
stamina = move_toward(stamina, 1., delta * 0.2)
%StaminaBar.value = stamina
@ -133,6 +136,10 @@ func _process_cam_shake(delta: float) -> void:
%Camera3D.position += v * 1.5
func _process_engine_sfx() -> void:
var speed := velocity.length()
%EngineSFX.pitch_scale = clampf(remap(speed, 0, MOVE_SPEED, 1., 1.25), 1., 1.5)
func _process(delta: float) -> void:
if not Level.is_active(): return
match state:
@ -146,6 +153,7 @@ func _process(delta: float) -> void:
_process_shoot(delta)
_process_cam_shake(delta)
_process_stamina(delta)
_process_engine_sfx()
damage_clock -= delta
@ -174,9 +182,10 @@ func _process(delta: float) -> void:
func damage(damager: Node3D) -> void:
if health <= 0: return
if state == State.DASHING:
damager.queue_free()
damager.kill()
else:
if damage_clock <= 0.:
%CrashSFX.play()
health -= 1
damage_clock = 3
shake_duration = .25

View file

@ -12,6 +12,9 @@
[ext_resource type="Shader" uid="uid://cf3h3knluytmm" path="res://player/hp_outline.gdshader" id="8_rgyib"]
[ext_resource type="Script" uid="uid://ban0rphntn10r" path="res://player/stamina_bar.gd" id="9_hg6s5"]
[ext_resource type="PackedScene" uid="uid://54f44t3gniw2" path="res://models/vehicles/tank.glb" id="10_8t03j"]
[ext_resource type="AudioStream" uid="uid://bdsy6ok06lerf" path="res://sfx/u_mgq59j5ayf-sound-effect-car-crash-394903.mp3" id="13_yllr7"]
[ext_resource type="AudioStream" uid="uid://p3uawesg4xq1" path="res://sfx/pwlpl-car_crash-377291.wav" id="14_kb6p2"]
[ext_resource type="AudioStream" uid="uid://42ntqiyti72f" path="res://sfx/engine.ogg" id="15_wodsf"]
[sub_resource type="FastNoiseLite" id="FastNoiseLite_onrkg"]
@ -58,6 +61,14 @@ height = 256
fill = 1
fill_from = Vector2(0.5, 0.5)
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_kb6p2"]
playback_mode = 1
random_pitch = 1.0293022
random_volume_offset_db = 3.0
streams_count = 2
stream_0/stream = ExtResource("13_yllr7")
stream_1/stream = ExtResource("14_kb6p2")
[node name="Player" type="CharacterBody3D" unique_id=1904432250 node_paths=PackedStringArray("cannon", "guns")]
collision_layer = 2
collision_mask = 13
@ -312,4 +323,17 @@ cull_mask = 1
unique_name_in_owner = true
transform = Transform3D(-0.6377325, 0, -5.5752345e-08, 0, 0.6377325, 0, 5.5752345e-08, 0, -0.6377325, 0, 0.75759906, 0)
[node name="AudioListener3D" type="AudioListener3D" parent="." unique_id=1114579283]
current = true
[node name="CrashSFX" type="AudioStreamPlayer" parent="." unique_id=1313499323]
unique_name_in_owner = true
stream = SubResource("AudioStreamRandomizer_kb6p2")
volume_db = 4.0
[node name="EngineSFX" type="AudioStreamPlayer" parent="." unique_id=668897298]
unique_name_in_owner = true
stream = ExtResource("15_wodsf")
volume_db = -6.0
[editable path="Tank"]

Binary file not shown.

Binary file not shown.

BIN
sfx/engine.ogg Normal file

Binary file not shown.

19
sfx/engine.ogg.import Normal file
View file

@ -0,0 +1,19 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://42ntqiyti72f"
path="res://.godot/imported/engine.ogg-4b2c0f0147799d259b4af1198db9c53f.oggvorbisstr"
[deps]
source_file="res://sfx/engine.ogg"
dest_files=["res://.godot/imported/engine.ogg-4b2c0f0147799d259b4af1198db9c53f.oggvorbisstr"]
[params]
loop=true
loop_offset=0.0
bpm=0.0
beat_count=0
bar_beats=4

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://q8b6o255ofgb"
path="res://.godot/imported/police-siren_90bpm_A#_major.wav-16a1b1744e67af3b6e79359a80f5fd5b.sample"
[deps]
source_file="res://sfx/police-siren_90bpm_A#_major.wav"
dest_files=["res://.godot/imported/police-siren_90bpm_A#_major.wav-16a1b1744e67af3b6e79359a80f5fd5b.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

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://p3uawesg4xq1"
path="res://.godot/imported/pwlpl-car_crash-377291.wav-07d6e8bdfcada1cecb6932166a9e4a13.sample"
[deps]
source_file="res://sfx/pwlpl-car_crash-377291.wav"
dest_files=["res://.godot/imported/pwlpl-car_crash-377291.wav-07d6e8bdfcada1cecb6932166a9e4a13.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

Binary file not shown.

View file

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://bdsy6ok06lerf"
path="res://.godot/imported/u_mgq59j5ayf-sound-effect-car-crash-394903.mp3-65b24366527ead86fccd7729d4ee70ee.mp3str"
[deps]
source_file="res://sfx/u_mgq59j5ayf-sound-effect-car-crash-394903.mp3"
dest_files=["res://.godot/imported/u_mgq59j5ayf-sound-effect-car-crash-394903.mp3-65b24366527ead86fccd7729d4ee70ee.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4