aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorHenauxg <19689618+Henauxg@users.noreply.github.com>2022-11-18 18:49:13 +0100
committerHenauxg <19689618+Henauxg@users.noreply.github.com>2022-11-18 18:49:13 +0100
commitef448e82ff34a2601f368b08217421138bf4a64c (patch)
tree01e656d8f9ade8bd33f927a805b2c271df6a2cab /examples
parent91e249b0dbf72cfda23b8c3bae9ef7566f4bdd82 (diff)
[exmaple:breakout] Reduce the audio volume of the collisions
Diffstat (limited to 'examples')
-rw-r--r--examples/breakout/client.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/examples/breakout/client.rs b/examples/breakout/client.rs
index 5d07e7f..de59d00 100644
--- a/examples/breakout/client.rs
+++ b/examples/breakout/client.rs
@@ -4,8 +4,8 @@ use bevy::{
prelude::{
default, AssetServer, Audio, BuildChildren, Bundle, Button, ButtonBundle, Camera2dBundle,
Changed, Color, Commands, Component, DespawnRecursiveExt, Entity, EventReader, EventWriter,
- Input, KeyCode, Local, Query, Res, ResMut, Resource, State, TextBundle, Transform, Vec2,
- Vec3, With, Without,
+ Input, KeyCode, Local, PlaybackSettings, Query, Res, ResMut, Resource, State, TextBundle,
+ Transform, Vec2, Vec3, With, Without,
},
sprite::{Sprite, SpriteBundle},
text::{Text, TextSection, TextStyle},
@@ -328,7 +328,13 @@ pub(crate) fn play_collision_sound(
if !collision_events.is_empty() {
// This prevents events staying active on the next frame.
collision_events.clear();
- audio.play(sound.0.clone());
+ audio.play_with_settings(
+ sound.0.clone(),
+ PlaybackSettings {
+ volume: 0.1,
+ ..Default::default()
+ },
+ );
}
}