Added shot SFX

This commit is contained in:
Rob Kelly 2024-11-22 12:26:25 -07:00
parent 162f2237d4
commit 074dbb06dc
19 changed files with 350 additions and 2 deletions

88
asset_credits.org Normal file
View File

@ -0,0 +1,88 @@
GFOLF: Combat Golf Action
Asset credits
* Graphics
** Clear Sea Water
*** Retrieved from https://www.the3rdsequence.com/texturedb/texture/44/clear+sea+water/
*** Author: the3rdSequence
*** License: CC BY 4.0
* Fonts
** Dokdo
*** Retrieved from https://fonts.google.com/specimen/Dokdo
*** Author: FONTRIX
*** License: OFL 1.1
** Geo
*** Retrieved from https://fonts.google.com/specimen/Geo
*** Author: Ben Weiner
*** License: OFL 1.1
** Racing Sans One
*** Retrieved from https://fonts.google.com/specimen/Racing+Sans+One
*** Author: Impallari Type
*** License: OFL 1.1
* Sound
** drive1.wav
*** Retrieved from https://freesound.org/people/zolopher/sounds/75203/
*** Author: zolopher
*** License: CC0
** drive2.wav
*** Retrieved from https://freesound.org/people/zolopher/sounds/75214/
*** Author: zolopher
*** License: CC0
** drive3.wav
*** Retrieved from https://freesound.org/people/zolopher/sounds/75204/
*** Author: zolopher
*** License: CC0
** drive4.wav
*** Retrieved from https://freesound.org/people/13FPanska_Marval_Lukas/sounds/379328/
*** Author: 13FPanska_Marval_Lukas
*** License: CC0
** hole.wav
*** Retrieved from https://freesound.org/people/inbeeld/sounds/21878/
*** Author: inbeeld
*** License: CC0
** putt1.wav
*** Retrieved from https://freesound.org/people/lmbubec/sounds/119451/
*** Author: lmbubec
*** License: CC0

BIN
asset_dev/audio/drive4.wav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/sound/sfx/player/drive1.wav (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://cllhgumv1fkju"
path="res://.godot/imported/drive1.wav-37a2ebf3422caee7737ed14d066e94ec.sample"
[deps]
source_file="res://assets/sound/sfx/player/drive1.wav"
dest_files=["res://.godot/imported/drive1.wav-37a2ebf3422caee7737ed14d066e94ec.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=0

BIN
assets/sound/sfx/player/drive2.wav (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://c8vouau0488fh"
path="res://.godot/imported/drive2.wav-40bb0e3487bcffb646233c3e9c9465a1.sample"
[deps]
source_file="res://assets/sound/sfx/player/drive2.wav"
dest_files=["res://.godot/imported/drive2.wav-40bb0e3487bcffb646233c3e9c9465a1.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=0

BIN
assets/sound/sfx/player/drive3.wav (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://cskhg5l86yvkw"
path="res://.godot/imported/drive3.wav-cc637d549cbfcb948c40cc777dca0600.sample"
[deps]
source_file="res://assets/sound/sfx/player/drive3.wav"
dest_files=["res://.godot/imported/drive3.wav-cc637d549cbfcb948c40cc777dca0600.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=0

BIN
assets/sound/sfx/player/drive4.wav (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://bkd8py2e7yfat"
path="res://.godot/imported/drive4.wav-b79415fd0bf467327ac8875e2a0a8c6a.sample"
[deps]
source_file="res://assets/sound/sfx/player/drive4.wav"
dest_files=["res://.godot/imported/drive4.wav-b79415fd0bf467327ac8875e2a0a8c6a.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=0

BIN
assets/sound/sfx/player/hole.wav (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://b1pnbcsi0jrlf"
path="res://.godot/imported/hole.wav-084f4e3629b5927d5a661d5f59a9d3e7.sample"
[deps]
source_file="res://assets/sound/sfx/player/hole.wav"
dest_files=["res://.godot/imported/hole.wav-084f4e3629b5927d5a661d5f59a9d3e7.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=0

BIN
assets/sound/sfx/player/putt1.wav (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://j54ssyodqnn3"
path="res://.godot/imported/putt1.wav-f5b4cf94df3968330049619e9410ebd1.sample"
[deps]
source_file="res://assets/sound/sfx/player/putt1.wav"
dest_files=["res://.godot/imported/putt1.wav-f5b4cf94df3968330049619e9410ebd1.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=0

15
default_bus_layout.tres Normal file
View File

@ -0,0 +1,15 @@
[gd_resource type="AudioBusLayout" format=3 uid="uid://cwxndi28bii8d"]
[resource]
bus/1/name = &"SFX"
bus/1/solo = false
bus/1/mute = false
bus/1/bypass_fx = false
bus/1/volume_db = 0.0
bus/1/send = &"Master"
bus/2/name = &"Music"
bus/2/solo = false
bus/2/mute = false
bus/2/bypass_fx = false
bus/2/volume_db = 0.0
bus/2/send = &"Master"

View File

@ -189,6 +189,7 @@ handle_input_locally = false
msaa_3d = 3
screen_space_aa = 1
use_taa = true
audio_listener_enable_3d = true
size = Vector2i(1920, 1080)
render_target_update_mode = 4

View File

@ -140,6 +140,7 @@ var _tracking_camera: OrbitalCamera
@onready var character: CharacterController = $PlayerPivot/GfolfGirl
@onready var shot_animation: AnimationPlayer = %ShotAnimation
@onready var shot_sfx: ShotSFX = %ShotSFX
@onready var arrow: Node3D = %Arrow
@onready var arrow_pivot: Node3D = %ArrowPivot
@ -230,6 +231,10 @@ func is_active() -> bool:
return phase != Phase.FINISHED
func is_shot_good() -> bool:
return abs(shot_curve) <= NICE_THRESHOLD
func finish_downswing() -> void:
phase = Phase.SHOT
@ -270,6 +275,9 @@ func take_shot() -> void:
game_ball.freeze = false
game_ball.apply_impulse(impulse, offset)
# Play SFX
shot_sfx.play_shot_sfx(club, is_shot_good(), shot_power)
# Use a ball if a limited type is selected
if player.get_balls(ball_type) > 0:
player.mutate_balls(ball_type, -1)
@ -441,7 +449,7 @@ func _on_phase_change(new_phase: Phase) -> void:
if perfect_aim:
shot_curve = 0.0
if abs(shot_curve) <= NICE_THRESHOLD:
if is_shot_good():
hud.play_nice_animation()
if not driving_range:

View File

@ -1,15 +1,38 @@
[gd_scene load_steps=23 format=3 uid="uid://cy7t2tc4y3b4"]
[gd_scene load_steps=32 format=3 uid="uid://cy7t2tc4y3b4"]
[ext_resource type="Script" path="res://src/player/shot_setup/shot_setup.gd" id="1_r6ei4"]
[ext_resource type="Script" path="res://src/player/shot_setup/ball_point.gd" id="2_e6i3g"]
[ext_resource type="PackedScene" uid="uid://c2k88ns0h5ie1" path="res://src/ui/3d/arrow/arrow.tscn" id="2_s70wl"]
[ext_resource type="Script" path="res://src/player/shot_setup/shot_sfx.gd" id="3_7vs2d"]
[ext_resource type="PackedScene" uid="uid://1s3gywmoi20e" path="res://src/characters/player_characters/gfolf_girl/gfolf_girl.tscn" id="3_e4aur"]
[ext_resource type="AudioStream" uid="uid://cllhgumv1fkju" path="res://assets/sound/sfx/player/drive1.wav" id="3_em3cj"]
[ext_resource type="AudioStream" uid="uid://c8vouau0488fh" path="res://assets/sound/sfx/player/drive2.wav" id="4_4cajc"]
[ext_resource type="PackedScene" uid="uid://fht6j87o8ecr" path="res://src/ui/3d/projectile_arc/projectile_arc.tscn" id="4_ry2ho"]
[ext_resource type="AudioStream" uid="uid://cskhg5l86yvkw" path="res://assets/sound/sfx/player/drive3.wav" id="5_5lj1j"]
[ext_resource type="AudioStream" uid="uid://bkd8py2e7yfat" path="res://assets/sound/sfx/player/drive4.wav" id="6_1wnu3"]
[ext_resource type="PackedScene" uid="uid://dbdul15c4oblg" path="res://src/ui/3d/projected_target.tscn" id="6_mynqj"]
[ext_resource type="AudioStream" uid="uid://j54ssyodqnn3" path="res://assets/sound/sfx/player/putt1.wav" id="7_niyj5"]
[ext_resource type="Script" path="res://src/player/shot_setup/hitbox.gd" id="7_uh8kn"]
[ext_resource type="Texture2D" uid="uid://2yoipvd107t1" path="res://assets/sprites/dope_explosion/dope_explosion.tres" id="8_5ghmo"]
[ext_resource type="FontFile" uid="uid://dsa0oh7c0h4pu" path="res://assets/fonts/Racing_Sans_One/RacingSansOne-Regular.ttf" id="9_y5iv1"]
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_gh0gi"]
random_pitch = 1.1
streams_count = 1
stream_0/stream = ExtResource("3_em3cj")
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_7isox"]
random_pitch = 1.1
streams_count = 3
stream_0/stream = ExtResource("4_4cajc")
stream_1/stream = ExtResource("5_5lj1j")
stream_2/stream = ExtResource("6_1wnu3")
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_wnuop"]
random_pitch = 1.1
streams_count = 1
stream_0/stream = ExtResource("7_niyj5")
[sub_resource type="Animation" id="Animation_ug2a7"]
length = 0.001
tracks/0/type = "value"
@ -262,6 +285,27 @@ unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.08, 0)
script = ExtResource("2_e6i3g")
[node name="ShotSFX" type="Node3D" parent="BallPoint"]
unique_name_in_owner = true
script = ExtResource("3_7vs2d")
[node name="GoodDriveSFXPlayer" type="AudioStreamPlayer3D" parent="BallPoint/ShotSFX"]
unique_name_in_owner = true
stream = SubResource("AudioStreamRandomizer_gh0gi")
volume_db = -3.0
bus = &"SFX"
[node name="BadDriveSFXPlayer" type="AudioStreamPlayer3D" parent="BallPoint/ShotSFX"]
unique_name_in_owner = true
stream = SubResource("AudioStreamRandomizer_7isox")
volume_db = -1.0
bus = &"SFX"
[node name="PuttSFXPlayer" type="AudioStreamPlayer3D" parent="BallPoint/ShotSFX"]
unique_name_in_owner = true
stream = SubResource("AudioStreamRandomizer_wnuop")
bus = &"SFX"
[node name="PlayerPivot" type="Node3D" parent="."]
unique_name_in_owner = true

View File

@ -0,0 +1,27 @@
class_name ShotSFX extends Node3D
## SFX controller for golf shots
const BASE_VOLUME := -6.0
const MAX_VOLUME := -1.0
@onready var good_drive_sfx_player: AudioStreamPlayer3D = %GoodDriveSFXPlayer
@onready var bad_drive_sfx_player: AudioStreamPlayer3D = %BadDriveSFXPlayer
@onready var putt_sfx_player: AudioStreamPlayer3D = %PuttSFXPlayer
func _attenuate_volume(power: float) -> float:
return lerpf(BASE_VOLUME, MAX_VOLUME, power)
func play_shot_sfx(club: Club.Type, good: bool, power: float) -> void:
var player: AudioStreamPlayer3D
match club:
Club.Type.PUTTER:
player = putt_sfx_player
_:
# TODO more varied SFX maybe?
player = good_drive_sfx_player if good else bad_drive_sfx_player
player.volume_db = _attenuate_volume(power)
print_debug("Playing ", player)
player.play()