Skip to content

Commit

Permalink
Impact sfx
Browse files Browse the repository at this point in the history
  • Loading branch information
Waridley committed Feb 8, 2024
1 parent e740197 commit b1f37e0
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 1 deletion.
3 changes: 3 additions & 0 deletions rs/assets/sfx/Kenney/Audio/impactMetal_000.ogg
Git LFS file not shown
7 changes: 7 additions & 0 deletions rs/assets/sfx/Kenney/Audio/impactMetal_000.ogg.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(
meta_format_version: "1.0",
asset: Load(
loader: "bevy_kira_audio::source::ogg_loader::OggLoader",
settings: (),
),
)
3 changes: 3 additions & 0 deletions rs/assets/sfx/Kenney/Audio/impactMetal_001.ogg
Git LFS file not shown
7 changes: 7 additions & 0 deletions rs/assets/sfx/Kenney/Audio/impactMetal_001.ogg.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(
meta_format_version: "1.0",
asset: Load(
loader: "bevy_kira_audio::source::ogg_loader::OggLoader",
settings: (),
),
)
3 changes: 3 additions & 0 deletions rs/assets/sfx/Kenney/Audio/impactMetal_002.ogg
Git LFS file not shown
7 changes: 7 additions & 0 deletions rs/assets/sfx/Kenney/Audio/impactMetal_002.ogg.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(
meta_format_version: "1.0",
asset: Load(
loader: "bevy_kira_audio::source::ogg_loader::OggLoader",
settings: (),
),
)
3 changes: 3 additions & 0 deletions rs/assets/sfx/Kenney/Audio/impactMetal_003.ogg
Git LFS file not shown
7 changes: 7 additions & 0 deletions rs/assets/sfx/Kenney/Audio/impactMetal_003.ogg.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(
meta_format_version: "1.0",
asset: Load(
loader: "bevy_kira_audio::source::ogg_loader::OggLoader",
settings: (),
),
)
3 changes: 3 additions & 0 deletions rs/assets/sfx/Kenney/Audio/impactMetal_004.ogg
Git LFS file not shown
7 changes: 7 additions & 0 deletions rs/assets/sfx/Kenney/Audio/impactMetal_004.ogg.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(
meta_format_version: "1.0",
asset: Load(
loader: "bevy_kira_audio::source::ogg_loader::OggLoader",
settings: (),
),
)
3 changes: 2 additions & 1 deletion rs/src/enemies/dummy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use bevy::{
ecs::system::{EntityCommands, SystemParamItem},
prelude::*,
};
use bevy_kira_audio::Audio;
use bevy_kira_audio::{Audio, AudioControl};
use bevy_rapier3d::{
dynamics::LockedAxes,
math::Vect,
Expand Down Expand Up @@ -165,6 +165,7 @@ pub fn handle_hits(
.copied()
.and_then(|body| ctx.bodies.get_mut(body))
{
audio.play(sfx.impacts[0].clone());
body.set_locked_axes(rapier3d::prelude::LockedAxes::empty(), true);
body.apply_impulse_at_point(
Vector3::from(global.compute_transform().rotation * toi.normal2) * 2000.0,
Expand Down
7 changes: 7 additions & 0 deletions rs/src/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ pub fn setup(
fire_a: asset_server.load("sfx/Kenney/Audio/laserSmall_004.ogg"),
dash: asset_server.load("sfx/Kenney/Audio/forceField_000.ogg"),
jump: asset_server.load("sfx/Kenney/Audio/forceField_002.ogg"),
impacts: [
asset_server.load("sfx/Kenney/Audio/impactMetal_000.ogg"),
asset_server.load("sfx/Kenney/Audio/impactMetal_001.ogg"),
asset_server.load("sfx/Kenney/Audio/impactMetal_002.ogg"),
asset_server.load("sfx/Kenney/Audio/impactMetal_003.ogg"),
asset_server.load("sfx/Kenney/Audio/impactMetal_004.ogg"),
],
});

let ship_scene = asset_server.load("ships/player.glb#Scene0");
Expand Down
1 change: 1 addition & 0 deletions rs/src/player/abilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ pub struct Sfx {
pub aoe: Handle<AudioSource>,
pub dash: Handle<AudioSource>,
pub jump: Handle<AudioSource>,
pub impacts: [Handle<AudioSource>; 5],
}

#[derive(Component, Debug)]
Expand Down

0 comments on commit b1f37e0

Please sign in to comment.