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

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"]