From 4a98354069725cf7c82d73bb4e67c1f3578707e5 Mon Sep 17 00:00:00 2001 From: Derek Christ Date: Fri, 12 Apr 2024 15:39:34 +0200 Subject: [PATCH] Remove audio entity after playing --- Cargo.lock | 4 ++-- src/snake.rs | 4 ++-- src/snake/direction.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 133c381..ba37b7c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.16" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "alsa" diff --git a/src/snake.rs b/src/snake.rs index 0c0ad78..641ab62 100644 --- a/src/snake.rs +++ b/src/snake.rs @@ -268,7 +268,7 @@ fn game_over_system(mut next_state: ResMut>) { fn collision_sound_system(mut commands: Commands, audio_assets: Res) { commands.spawn(AudioBundle { source: audio_assets.collision.clone(), - ..Default::default() + settings: PlaybackSettings::DESPAWN, }); } @@ -280,7 +280,7 @@ fn blip_sound_system( for _ in eaten_event_reader.read() { commands.spawn(AudioBundle { source: audio_assets.blip.clone(), - ..Default::default() + settings: PlaybackSettings::DESPAWN, }); } } diff --git a/src/snake/direction.rs b/src/snake/direction.rs index af6576a..112703e 100644 --- a/src/snake/direction.rs +++ b/src/snake/direction.rs @@ -64,7 +64,7 @@ pub(super) fn change_direction_system( commands.entity(snake).insert(NextDirection(new_direction)); commands.spawn(AudioBundle { source: audio_assets.tick.clone(), - ..Default::default() + settings: PlaybackSettings::DESPAWN, }); } }