Remove audio entity after playing
This commit is contained in:
@@ -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,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user