weapon SFX

This commit is contained in:
Michael Campbell 2026-04-15 13:03:13 -04:00
parent afc0aab441
commit 2f30c9f04b
16 changed files with 132 additions and 11 deletions

View file

@ -9,3 +9,6 @@ var fire_rate := 125.
@abstract
func fire(aim_angle: float) -> void
func _process(delta: float) -> void:
fire_clock -= delta

View file

@ -8,3 +8,5 @@ func fire(aim_angle: float) -> void:
player_projectile.global_position = global_position + Vector3.UP * 0.5
get_tree().current_scene.add_child(player_projectile)
fire_clock = 60. / fire_rate
%SharpshooterFire.play()

View file

@ -13,3 +13,5 @@ func fire(aim_angle: float) -> void:
fire_clock = 60. / fire_rate
Player.instance.velocity += -dir * 10.
%MiniGunFire.play()

View file

@ -35,3 +35,5 @@ func fire(_aim_angle: float) -> void:
get_tree().current_scene.add_child(proj)
fire_clock = 60. / fire_rate
%MortarFire.play()

View file

@ -107,19 +107,11 @@ func _process_aim() -> void:
%Reticle.position = to_mouse_pos
func _process_shoot(delta: float) -> void:
var clock_mul := 1.
# match state:
# State.DASHING: clock_mul = 2.5
# State.LOCKED: clock_mul = 2.5
if gun_index == MORTAR_IDX and Input.is_action_pressed("fire"):
speed_mul = exp_lerp(speed_mul, 0.25, 5, delta)
else:
speed_mul = exp_lerp(speed_mul, 1., 5, delta)
gun.fire_clock -= delta * clock_mul
if Input.is_action_pressed("fire") and gun.fire_clock <= 0.:
gun.fire(aim_angle)
@ -139,7 +131,7 @@ func _process_cam_shake(delta: float) -> void:
camera_transform.basis.x * x + \
camera_transform.basis.y * y
%Camera3D.position += v * .75
%Camera3D.position += v * 1.5
func _process(delta: float) -> void:
if not Level.is_active(): return

View file

@ -5,11 +5,13 @@
[ext_resource type="Script" uid="uid://cjdxibg3pnans" path="res://player/score_label.gd" id="2_onrkg"]
[ext_resource type="Script" uid="uid://fv1n5noqdfg2" path="res://player/guns/basic_gun.gd" id="3_g1dw6"]
[ext_resource type="Script" uid="uid://b87cyvu2m5b1k" path="res://player/guns/mini_gun.gd" id="4_yw30f"]
[ext_resource type="AudioStream" uid="uid://djrp7mwg3pbrq" path="res://sfx/freesound_community-meaty-gunshot-101257.mp3" id="5_2ieo8"]
[ext_resource type="Script" uid="uid://ftrngxkkycl1" path="res://player/guns/mortar.gd" id="5_qjkh3"]
[ext_resource type="Script" uid="uid://urxp3pg8g2mh" path="res://player/health_bar.gd" id="7_boad6"]
[ext_resource type="AudioStream" uid="uid://b42aa4bhyfv12" path="res://sfx/mortar_shot.wav" id="8_ebec5"]
[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/tank.glb" id="10_8t03j"]
[ext_resource type="PackedScene" uid="uid://54f44t3gniw2" path="res://models/vehicles/tank.glb" id="10_8t03j"]
[sub_resource type="FastNoiseLite" id="FastNoiseLite_onrkg"]
@ -17,6 +19,22 @@
[sub_resource type="SphereMesh" id="SphereMesh_4flbx"]
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_2ieo8"]
random_pitch = 1.0594631
random_volume_offset_db = 1.0
streams_count = 1
stream_0/stream = ExtResource("5_2ieo8")
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_yllr7"]
random_pitch = 1.0293022
streams_count = 1
stream_0/stream = ExtResource("5_2ieo8")
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_ebec5"]
random_volume_offset_db = 1.0
streams_count = 1
stream_0/stream = ExtResource("8_ebec5")
[sub_resource type="ViewportTexture" id="ViewportTexture_g6k8r"]
viewport_path = NodePath("OnPlayerHUD")
@ -142,15 +160,31 @@ horizontal_alignment = 1
unique_name_in_owner = true
script = ExtResource("3_g1dw6")
[node name="SharpshooterFire" type="AudioStreamPlayer" parent="Guns/Sharpshooter" unique_id=434739790]
unique_name_in_owner = true
stream = SubResource("AudioStreamRandomizer_2ieo8")
volume_db = -4.0
[node name="MiniGun" type="Node3D" parent="Guns" unique_id=416187827]
unique_name_in_owner = true
script = ExtResource("4_yw30f")
fire_rate = 800.0
[node name="MiniGunFire" type="AudioStreamPlayer" parent="Guns/MiniGun" unique_id=325727002]
unique_name_in_owner = true
stream = SubResource("AudioStreamRandomizer_yllr7")
volume_db = -6.0
pitch_scale = 1.5
max_polyphony = 10
[node name="Mortar" type="Node3D" parent="Guns" unique_id=1321220525]
unique_name_in_owner = true
script = ExtResource("5_qjkh3")
fire_rate = 160.0
fire_rate = 70.0
[node name="MortarFire" type="AudioStreamPlayer" parent="Guns/Mortar" unique_id=2137084473]
unique_name_in_owner = true
stream = SubResource("AudioStreamRandomizer_ebec5")
[node name="OnPlayerHUDSprite" type="Sprite3D" parent="." unique_id=1611457281]
transform = Transform3D(2.5426614, 0, 0, 0, 1.4438343, 2.0929568, 0, -2.0929568, 1.4438343, 0, 3.1055684, 0.17435753)

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://djrp7mwg3pbrq"
path="res://.godot/imported/freesound_community-meaty-gunshot-101257.mp3-fc2eb3231e134d33dba9af49b0564c9e.mp3str"
[deps]
source_file="res://sfx/freesound_community-meaty-gunshot-101257.mp3"
dest_files=["res://.godot/imported/freesound_community-meaty-gunshot-101257.mp3-fc2eb3231e134d33dba9af49b0564c9e.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View file

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://c0up0bvkvrnjd"
path="res://.godot/imported/freesound_community-meaty-gunshot-underwater-101180.mp3-9730b1b872c330fee33de89018927243.mp3str"
[deps]
source_file="res://sfx/freesound_community-meaty-gunshot-underwater-101180.mp3"
dest_files=["res://.godot/imported/freesound_community-meaty-gunshot-underwater-101180.mp3-9730b1b872c330fee33de89018927243.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://c3um534f68ifu"
path="res://.godot/imported/freesound_community-pistol-cock-6014.wav-42d74cd6b77ff9278ab449b6057b76e5.sample"
[deps]
source_file="res://sfx/freesound_community-pistol-cock-6014.wav"
dest_files=["res://.godot/imported/freesound_community-pistol-cock-6014.wav-42d74cd6b77ff9278ab449b6057b76e5.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

BIN
sfx/mortar_shot.wav Normal file

Binary file not shown.

View file

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://b42aa4bhyfv12"
path="res://.godot/imported/mortar_shot.wav-9c55384cd4d61728d2a2ab2bcc10411c.sample"
[deps]
source_file="res://sfx/mortar_shot.wav"
dest_files=["res://.godot/imported/mortar_shot.wav-9c55384cd4d61728d2a2ab2bcc10411c.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