Add ball sfx

This commit is contained in:
Sofia 2026-07-30 00:23:38 +03:00
parent f5af799531
commit a997783d50
10 changed files with 63 additions and 13 deletions

View File

@ -31,8 +31,14 @@ link = "https://www.zapsplat.com/sound-effect-packs/footsteps-on-fallen-tree-tru
credit = "Wine glasses full of wine and ice clink together, cheers, celebration, version 6"
link = "https://www.zapsplat.com/music/wine-glasses-full-of-wine-and-ice-clink-together-cheers-celebration-version-6/"
[[people.credits]]
credit = " Drinking glasses, champagne flutes with champagne in clink together, cheers, celebrating, version 4"
credit = "Drinking glasses, champagne flutes with champagne in clink together, cheers, celebrating, version 4"
link = "https://www.zapsplat.com/music/drinking-glasses-champagne-flutes-with-champagne-in-clink-together-cheers-celebrating-version-4/"
[[people.credits]]
credit = "Fantasy, inventory open 00"
link = "https://www.zapsplat.com/music/fantasy-inventory-open-00/"
[[people.credits]]
credit = "Basketball ball single bounce on outside court 3"
link = "https://www.zapsplat.com/music/basketball-ball-single-bounce-on-outside-court-3/"
[[people]]
name = "TripleSnail"

@ -1 +1 @@
Subproject commit 7f88273259f449fd9f2b5370f7a67cd711d7562f
Subproject commit 3e99ccff628de8311eb0018c24f9c3fc4ebacaa2

View File

@ -1,10 +1,12 @@
[gd_scene format=3 uid="uid://dfnbc8sbufa4j"]
[ext_resource type="PackedScene" uid="uid://r13poamopmnv" path="res://mesh/ball_mesh.tscn" id="1_texud"]
[ext_resource type="AudioStream" uid="uid://gpx6c15g3151" path="res://raw_assets/sfx/ball/zapsplat_sport_basketball_single_bounce_on_court_003_71655.mp3" id="2_xt7sd"]
[sub_resource type="SphereShape3D" id="SphereShape3D_1cgct"]
[node name="ball" type="Ball" unique_id=816748600]
[node name="ball" type="Ball" unique_id=816748600 node_paths=PackedStringArray("bounce_sfx")]
bounce_sfx = NodePath("bounce_sfx")
collision_layer = 8
collision_mask = 7
contact_monitor = true
@ -14,3 +16,7 @@ max_contacts_reported = 10
[node name="collision_shape_3d" type="CollisionShape3D" parent="." unique_id=1408432914]
shape = SubResource("SphereShape3D_1cgct")
[node name="bounce_sfx" type="AudioStreamPlayer3D" parent="." unique_id=929128469]
stream = ExtResource("2_xt7sd")
bus = &"SFX"

View File

@ -11,7 +11,7 @@ pickup_area = NodePath("area_3d")
sfx = NodePath("audio_stream_player_3d")
[node name="area_3d" type="Area3D" parent="." unique_id=168425054]
transform = Transform3D(0.9148415, 0, -0.4038132, 0, 1, 0, 0.4038132, 0, 0.9148415, 0, 1.3990467, 0)
transform = Transform3D(-0.49093452, 0, -0.87119645, 0, 1, 0, 0.87119645, 0, -0.49093452, 0, 1.2822008, 0)
collision_layer = 0
collision_mask = 3
@ -22,3 +22,4 @@ shape = SubResource("SphereShape3D_1cgct")
[node name="audio_stream_player_3d" type="AudioStreamPlayer3D" parent="." unique_id=2139430866]
stream = ExtResource("2_ogdjc")
bus = &"SFX"

View File

@ -8,6 +8,7 @@
[ext_resource type="AudioStream" uid="uid://upjuu3vc7tcs" path="res://raw_assets/sfx/zapsplat_glass/zapsplat_household_wine_glasses_full_wine_and_ice_clink_together_cheers_celebrate_006_111350.mp3" id="6_dguuj"]
[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"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_oh8vq"]
@ -17,7 +18,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")]
[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")]
look_sensitivity = 1.5
camera = NodePath("camera_3d")
vignette = NodePath("vignette")
@ -33,6 +34,7 @@ hud = NodePath("hud")
hit_sound = NodePath("hit_sound")
goal_sound_good = NodePath("goal_good")
goal_sound_bad = NodePath("goal_bad")
pickup_ball_sfx = NodePath("ball_pickup_sfx")
health = 100
punch_cooldown = 1.0
telegrenade_cd = 10.0
@ -111,6 +113,10 @@ bus = &"SFX"
stream = ExtResource("7_3nqsm")
bus = &"SFX"
[node name="ball_pickup_sfx" type="AudioStreamPlayer" parent="." unique_id=1503656313]
stream = ExtResource("8_cmcit")
bus = &"SFX"
[node name="hud" parent="." unique_id=2049159590 instance=ExtResource("5_cv68x")]
[connection signal="on_exit" from="hud" to="." method="exit"]

View File

@ -35,7 +35,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")]
[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")]
move_speed = 7.0
soldier_mesh = NodePath("soldier_m")
collider = NodePath("collision_shape_3d")
@ -49,6 +49,7 @@ health_bar = NodePath("health_bar_sprite/health_bar_viewport/health_bar")
double_health_bar = NodePath("double_health_bar_sprite/health_bar_viewport/double_health_bar")
health_bar_sprite = NodePath("health_bar_sprite")
double_health_bar_sprite = NodePath("double_health_bar_sprite")
ball_pickup_sfx = NodePath("ball_pickup_sfx")
telegrenade_cd = 10.0
collision_layer = 2
collision_mask = 4
@ -128,3 +129,6 @@ texture_progress = SubResource("CurveTexture_840kl")
tint_under = Color(0, 0, 0, 0)
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]
bus = &"SFX"

View File

@ -35,7 +35,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")]
[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")]
move_speed = 5.0
soldier_mesh = NodePath("soldier_m")
collider = NodePath("collision_shape_3d")
@ -49,6 +49,7 @@ health_bar = NodePath("health_bar_sprite/health_bar_viewport/health_bar")
double_health_bar = NodePath("double_health_bar_sprite/double_health_bar_viewport/double_health_bar")
health_bar_sprite = NodePath("health_bar_sprite")
double_health_bar_sprite = NodePath("double_health_bar_sprite")
ball_pickup_sfx = NodePath("ball_pickup_sfx")
collision_layer = 16
collision_mask = 4
@ -125,3 +126,6 @@ texture_progress = SubResource("CurveTexture_840kl")
tint_under = Color(0, 0, 0, 0)
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]
bus = &"SFX"

View File

@ -1,5 +1,5 @@
use godot::{
classes::{IRigidBody3D, RigidBody3D},
classes::{AudioStreamPlayer3D, IRigidBody3D, RigidBody3D},
prelude::*,
};
@ -11,6 +11,9 @@ use crate::{
#[derive(GodotClass)]
#[class(base=RigidBody3D, init)]
pub struct Ball {
#[export]
bounce_sfx: Option<Gd<AudioStreamPlayer3D>>,
pub dropper: Option<u16>,
pub entered_goal: bool,
@ -50,6 +53,10 @@ impl Ball {
}
fn on_collision(&mut self, node: Gd<Node>) {
if let Some(bounce_sfx) = &mut self.bounce_sfx {
bounce_sfx.play();
}
if let Ok(player) = node.try_dynify::<dyn IPlayer>()
&& let Some(player_id) = player.dyn_bind().get_player_id()
{

View File

@ -72,6 +72,8 @@ pub struct LocalPlayer {
#[export]
goal_sound_bad: Option<Gd<AudioStreamPlayer>>,
#[export]
pickup_ball_sfx: Option<Gd<AudioStreamPlayer>>,
#[export]
health: i32,
#[export]
punch_cooldown: f64,
@ -308,6 +310,9 @@ impl IPlayer for LocalPlayer {
if let Some(ball) = &mesh.bind().ball {
self.spawn_weapon(ball.instantiate_as::<BallWeapon>().into_dyn().upcast());
}
if let Some(ball_pickup_sfx) = &mut self.pickup_ball_sfx {
ball_pickup_sfx.play();
}
}
};
}

View File

@ -1,7 +1,7 @@
use godot::{
classes::{
Camera3D, CharacterBody3D, CollisionShape3D, ICharacterBody3D, Label3D, Sprite3D,
TextureProgressBar,
AudioStreamPlayer3D, Camera3D, CharacterBody3D, CollisionShape3D, ICharacterBody3D,
Label3D, Sprite3D, TextureProgressBar,
},
obj::WithBaseField,
prelude::*,
@ -51,6 +51,8 @@ pub struct RemotePlayer {
health_bar_sprite: Option<Gd<Sprite3D>>,
#[export]
double_health_bar_sprite: Option<Gd<Sprite3D>>,
#[export]
ball_pickup_sfx: Option<Gd<AudioStreamPlayer3D>>,
pub player_id: Option<u16>,
pub player_name: String,
@ -236,9 +238,18 @@ impl IPlayer for RemotePlayer {
if let Some(mesh) = &mut self.soldier_mesh {
match weapon {
WeaponType::Raygun => mesh.bind_mut().spawn_raygun(),
WeaponType::Shotgun => mesh.bind_mut().spawn_shotgun(),
WeaponType::Ball => mesh.bind_mut().spawn_ball(),
WeaponType::Raygun => {
mesh.bind_mut().spawn_raygun();
if let Some(ball_pickup_sfx) = &mut self.ball_pickup_sfx {
ball_pickup_sfx.play();
}
}
WeaponType::Shotgun => {
mesh.bind_mut().spawn_shotgun();
}
WeaponType::Ball => {
mesh.bind_mut().spawn_ball();
}
};
}
}