Remove audio entity after playing

This commit is contained in:
2024-04-12 15:39:34 +02:00
parent 824231a86b
commit 4a98354069
3 changed files with 5 additions and 5 deletions

4
Cargo.lock generated
View File

@@ -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"

View File

@@ -268,7 +268,7 @@ fn game_over_system(mut next_state: ResMut<NextState<AppState>>) {
fn collision_sound_system(mut commands: Commands, audio_assets: Res<audio::Assets>) {
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,
});
}
}

View File

@@ -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,
});
}
}