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