Add ball throw sfx

This commit is contained in:
Sofia 2026-07-30 22:57:27 +03:00
parent 792a491767
commit 0e2b86de76
7 changed files with 51 additions and 6 deletions

View File

@ -36,6 +36,9 @@ link = "https://www.zapsplat.com/music/drinking-glasses-champagne-flutes-with-ch
[[people.credits]]
credit = "Fantasy, inventory open 00"
link = "https://www.zapsplat.com/music/fantasy-inventory-open-00/"
[[people.credits]]
credit = "Very hard and fast whoosh, swinging a stick through air, version 3"
link = "https://www.zapsplat.com/music/very-hard-and-fast-whoosh-swinging-a-stick-through-air-version-3/"
[[people]]
name = "TripleSnail"

@ -1 +1 @@
Subproject commit 14326d35eb7f01c0e8656c10c38747a705acb601
Subproject commit 4aa58e9b53032fb5cc8431a2102e75066313be35

View File

@ -9,6 +9,7 @@
[ext_resource type="AudioStream" uid="uid://jktwx7dyak2f" path="res://raw_assets/sfx/zapsplat_glass/zapsplat_household_drinking_glasses_champagne_flutes_full_champagne_clink_together_cheers_celebrate_004_111316.mp3" id="7_3nqsm"]
[ext_resource type="AudioStream" uid="uid://bfg31e3s4jv8c" path="res://raw_assets/sfx/Hit.mp3" id="7_dguuj"]
[ext_resource type="AudioStream" uid="uid://cl416orgv11vj" path="res://raw_assets/sfx/ball/little_robot_sound_factory_fantasy_Inventory_Open_00.mp3" id="8_cmcit"]
[ext_resource type="AudioStream" uid="uid://uq0o8gkpqhfa" path="res://raw_assets/sfx/ball/zapsplat_foley_stick_swing_air_whoosh_very_fast_hard_003_110413.mp3" id="9_qpw6d"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_oh8vq"]
@ -18,7 +19,7 @@ shader_parameter/Color = Color(1, 0, 0, 1)
shader_parameter/RimDistance = 0.7
shader_parameter/FloatParameter = 3.0
[node name="player" type="LocalPlayer" unique_id=863055906 node_paths=PackedStringArray("camera", "vignette", "soldier_mesh", "collider", "effects", "dead_cam_target", "respawn_label", "camera_origin", "weapon_node", "hud", "hit_sound", "goal_sound_good", "goal_sound_bad", "pickup_ball_sfx")]
[node name="player" type="LocalPlayer" unique_id=863055906 node_paths=PackedStringArray("camera", "vignette", "soldier_mesh", "collider", "effects", "dead_cam_target", "respawn_label", "camera_origin", "weapon_node", "hud", "hit_sound", "goal_sound_good", "goal_sound_bad", "pickup_ball_sfx", "throw_ball_sfx")]
look_sensitivity = 1.5
camera = NodePath("camera_3d")
vignette = NodePath("vignette")
@ -35,6 +36,7 @@ hit_sound = NodePath("hit_sound")
goal_sound_good = NodePath("goal_good")
goal_sound_bad = NodePath("goal_bad")
pickup_ball_sfx = NodePath("ball_pickup_sfx")
throw_ball_sfx = NodePath("ball_throw_sfx")
health = 100
punch_cooldown = 1.0
telegrenade_cd = 10.0
@ -117,6 +119,10 @@ bus = &"SFX"
stream = ExtResource("8_cmcit")
bus = &"SFX"
[node name="ball_throw_sfx" type="AudioStreamPlayer" parent="." unique_id=1577850877]
stream = ExtResource("9_qpw6d")
bus = &"SFX"
[node name="hud" parent="." unique_id=2049159590 instance=ExtResource("5_cv68x")]
[connection signal="on_exit" from="hud" to="." method="exit"]

View File

@ -2,6 +2,8 @@
[ext_resource type="PackedScene" uid="uid://bod6b3befmyt5" path="res://scenes/player/soldier_m.tscn" id="1_e2ekk"]
[ext_resource type="PackedScene" uid="uid://cl66unms2gim0" path="res://scenes/player/effects.tscn" id="2_orxjf"]
[ext_resource type="AudioStream" uid="uid://cl416orgv11vj" path="res://raw_assets/sfx/ball/little_robot_sound_factory_fantasy_Inventory_Open_00.mp3" id="3_840kl"]
[ext_resource type="AudioStream" uid="uid://uq0o8gkpqhfa" path="res://raw_assets/sfx/ball/zapsplat_foley_stick_swing_air_whoosh_very_fast_hard_003_110413.mp3" id="4_qn18y"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_1cgct"]
@ -35,7 +37,7 @@ curve = SubResource("Curve_qn18y")
[sub_resource type="ViewportTexture" id="ViewportTexture_rmxnb"]
viewport_path = NodePath("double_health_bar_sprite/health_bar_viewport")
[node name="player" type="RemotePlayer" unique_id=845968872 node_paths=PackedStringArray("soldier_mesh", "collider", "effects", "spectator_camera", "camera_origin", "name_label", "health_bar", "double_health_bar", "health_bar_sprite", "double_health_bar_sprite", "ball_pickup_sfx")]
[node name="player" type="RemotePlayer" unique_id=845968872 node_paths=PackedStringArray("soldier_mesh", "collider", "effects", "spectator_camera", "camera_origin", "name_label", "health_bar", "double_health_bar", "health_bar_sprite", "double_health_bar_sprite", "ball_pickup_sfx", "ball_throw_sfx")]
move_speed = 7.0
soldier_mesh = NodePath("soldier_m")
collider = NodePath("collision_shape_3d")
@ -50,6 +52,7 @@ double_health_bar = NodePath("double_health_bar_sprite/health_bar_viewport/doubl
health_bar_sprite = NodePath("health_bar_sprite")
double_health_bar_sprite = NodePath("double_health_bar_sprite")
ball_pickup_sfx = NodePath("ball_pickup_sfx")
ball_throw_sfx = NodePath("ball_throw_sfx")
telegrenade_cd = 10.0
collision_layer = 2
collision_mask = 4
@ -131,4 +134,9 @@ tint_over = Color(1, 1, 1, 0)
tint_progress = Color(0.5660922, 1.7688051e-06, 3.3691526e-07, 1)
[node name="ball_pickup_sfx" type="AudioStreamPlayer3D" parent="." unique_id=1473967809]
stream = ExtResource("3_840kl")
bus = &"SFX"
[node name="ball_throw_sfx" type="AudioStreamPlayer3D" parent="." unique_id=198255565]
stream = ExtResource("4_qn18y")
bus = &"SFX"

View File

@ -2,6 +2,8 @@
[ext_resource type="PackedScene" uid="uid://bod6b3befmyt5" path="res://scenes/player/soldier_m.tscn" id="1_bfcd3"]
[ext_resource type="PackedScene" uid="uid://cl66unms2gim0" path="res://scenes/player/effects.tscn" id="2_rejks"]
[ext_resource type="AudioStream" uid="uid://cl416orgv11vj" path="res://raw_assets/sfx/ball/little_robot_sound_factory_fantasy_Inventory_Open_00.mp3" id="3_o85ek"]
[ext_resource type="AudioStream" uid="uid://uq0o8gkpqhfa" path="res://raw_assets/sfx/ball/zapsplat_foley_stick_swing_air_whoosh_very_fast_hard_003_110413.mp3" id="4_fwayu"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_1cgct"]
@ -35,7 +37,7 @@ curve = SubResource("Curve_qn18y")
[sub_resource type="ViewportTexture" id="ViewportTexture_bfcd3"]
viewport_path = NodePath("double_health_bar_sprite/double_health_bar_viewport")
[node name="player" type="RemotePlayer" unique_id=845968872 node_paths=PackedStringArray("soldier_mesh", "collider", "effects", "spectator_camera", "camera_origin", "name_label", "health_bar", "double_health_bar", "health_bar_sprite", "double_health_bar_sprite", "ball_pickup_sfx")]
[node name="player" type="RemotePlayer" unique_id=845968872 node_paths=PackedStringArray("soldier_mesh", "collider", "effects", "spectator_camera", "camera_origin", "name_label", "health_bar", "double_health_bar", "health_bar_sprite", "double_health_bar_sprite", "ball_pickup_sfx", "ball_throw_sfx")]
move_speed = 5.0
soldier_mesh = NodePath("soldier_m")
collider = NodePath("collision_shape_3d")
@ -50,6 +52,7 @@ double_health_bar = NodePath("double_health_bar_sprite/double_health_bar_viewpor
health_bar_sprite = NodePath("health_bar_sprite")
double_health_bar_sprite = NodePath("double_health_bar_sprite")
ball_pickup_sfx = NodePath("ball_pickup_sfx")
ball_throw_sfx = NodePath("ball_throw_sfx")
collision_layer = 16
collision_mask = 4
@ -128,4 +131,9 @@ tint_over = Color(1, 1, 1, 0)
tint_progress = Color(0.5660922, 1.7688051e-06, 3.3691526e-07, 1)
[node name="ball_pickup_sfx" type="AudioStreamPlayer3D" parent="." unique_id=330638520]
stream = ExtResource("3_o85ek")
bus = &"SFX"
[node name="ball_throw_sfx" type="AudioStreamPlayer3D" parent="." unique_id=1825805271]
stream = ExtResource("4_fwayu")
bus = &"SFX"

View File

@ -74,6 +74,8 @@ pub struct LocalPlayer {
#[export]
pickup_ball_sfx: Option<Gd<AudioStreamPlayer>>,
#[export]
throw_ball_sfx: Option<Gd<AudioStreamPlayer>>,
#[export]
health: i32,
#[export]
punch_cooldown: f64,
@ -327,7 +329,15 @@ impl IPlayer for LocalPlayer {
}
fn drop_ball(&mut self, with_velocity: bool) -> bool {
self.drop_ball_common(with_velocity)
if self.drop_ball_common(with_velocity)
&& with_velocity
&& let Some(sfx) = &mut self.throw_ball_sfx
{
sfx.play();
true
} else {
false
}
}
fn get_camera_origin(&self) -> Option<Gd<Node3D>> {

View File

@ -53,6 +53,8 @@ pub struct RemotePlayer {
double_health_bar_sprite: Option<Gd<Sprite3D>>,
#[export]
ball_pickup_sfx: Option<Gd<AudioStreamPlayer3D>>,
#[export]
ball_throw_sfx: Option<Gd<AudioStreamPlayer3D>>,
pub player_id: Option<u16>,
pub player_name: String,
@ -267,7 +269,15 @@ impl IPlayer for RemotePlayer {
}
fn drop_ball(&mut self, with_velocity: bool) -> bool {
self.drop_ball_common(with_velocity)
if self.drop_ball_common(with_velocity)
&& with_velocity
&& let Some(sfx) = &mut self.ball_throw_sfx
{
sfx.play();
true
} else {
false
}
}
fn get_camera_origin(&self) -> Option<Gd<Node3D>> {