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

@ -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()