diff --git a/default_bus_layout.tres b/default_bus_layout.tres new file mode 100644 index 0000000..6e2c67e --- /dev/null +++ b/default_bus_layout.tres @@ -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 diff --git a/enemies/base_enemy.tscn b/enemies/base_enemy.tscn index aab5932..1a8283e 100644 --- a/enemies/base_enemy.tscn +++ b/enemies/base_enemy.tscn @@ -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"] diff --git a/enemies/enemy.gd b/enemies/enemy.gd index ee1f428..a606134 100644 --- a/enemies/enemy.gd +++ b/enemies/enemy.gd @@ -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 diff --git a/enemies/police_car/weak_point.gd b/enemies/police_car/weak_point.gd index 120bd2b..c906d41 100644 --- a/enemies/police_car/weak_point.gd +++ b/enemies/police_car/weak_point.gd @@ -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() diff --git a/levels/timescale_node.gd b/levels/timescale_node.gd index 70db73e..6d93c5d 100644 --- a/levels/timescale_node.gd +++ b/levels/timescale_node.gd @@ -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 diff --git a/player/player.gd b/player/player.gd index 19b7336..c8a73fa 100644 --- a/player/player.gd +++ b/player/player.gd @@ -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 diff --git a/player/player.tscn b/player/player.tscn index 5edabf7..37abb48 100644 --- a/player/player.tscn +++ b/player/player.tscn @@ -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"] diff --git a/sfx/audacity/mortar_shot.aup3 b/sfx/audacity/mortar_shot.aup3 index eb33131..7dd77bd 100644 Binary files a/sfx/audacity/mortar_shot.aup3 and b/sfx/audacity/mortar_shot.aup3 differ diff --git a/sfx/audacity/mortar_shot.aup3-wal b/sfx/audacity/mortar_shot.aup3-wal deleted file mode 100644 index d47adfc..0000000 Binary files a/sfx/audacity/mortar_shot.aup3-wal and /dev/null differ diff --git a/sfx/engine.ogg b/sfx/engine.ogg new file mode 100644 index 0000000..111d766 Binary files /dev/null and b/sfx/engine.ogg differ diff --git a/sfx/engine.ogg.import b/sfx/engine.ogg.import new file mode 100644 index 0000000..f2fb480 --- /dev/null +++ b/sfx/engine.ogg.import @@ -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 diff --git a/sfx/police-siren_90bpm_A#_major.wav b/sfx/police-siren_90bpm_A#_major.wav new file mode 100644 index 0000000..9100961 Binary files /dev/null and b/sfx/police-siren_90bpm_A#_major.wav differ diff --git a/sfx/police-siren_90bpm_A#_major.wav.import b/sfx/police-siren_90bpm_A#_major.wav.import new file mode 100644 index 0000000..f389064 --- /dev/null +++ b/sfx/police-siren_90bpm_A#_major.wav.import @@ -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 diff --git a/sfx/pwlpl-car_crash-377291.wav b/sfx/pwlpl-car_crash-377291.wav new file mode 100644 index 0000000..78a8337 Binary files /dev/null and b/sfx/pwlpl-car_crash-377291.wav differ diff --git a/sfx/pwlpl-car_crash-377291.wav.import b/sfx/pwlpl-car_crash-377291.wav.import new file mode 100644 index 0000000..786f06a --- /dev/null +++ b/sfx/pwlpl-car_crash-377291.wav.import @@ -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 diff --git a/sfx/u_mgq59j5ayf-sound-effect-car-crash-394903.mp3 b/sfx/u_mgq59j5ayf-sound-effect-car-crash-394903.mp3 new file mode 100644 index 0000000..74eb091 Binary files /dev/null and b/sfx/u_mgq59j5ayf-sound-effect-car-crash-394903.mp3 differ diff --git a/sfx/u_mgq59j5ayf-sound-effect-car-crash-394903.mp3.import b/sfx/u_mgq59j5ayf-sound-effect-car-crash-394903.mp3.import new file mode 100644 index 0000000..fc146e7 --- /dev/null +++ b/sfx/u_mgq59j5ayf-sound-effect-car-crash-394903.mp3.import @@ -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