Skip to content

Commit

Permalink
Simplify despawning of antidote sound
Browse files Browse the repository at this point in the history
  • Loading branch information
tehlers committed Nov 4, 2023
1 parent 9629287 commit 9fa7ecd
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/game/systems/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ pub fn eat(
settings: PlaybackSettings::LOOP,
},
AntidoteSound,
OnGameScreen,
));
}
}
Expand Down Expand Up @@ -647,14 +648,8 @@ pub fn game_over(
mut game_state: ResMut<NextState<GameState>>,
mut lastscore: ResMut<Lastscore>,
mut highscore: ResMut<Highscore>,
antidote_sound: Query<(&AudioSink, Entity), With<AntidoteSound>>,
) {
if reader.iter().next().is_some() {
if let Ok(sound) = antidote_sound.get_single() {
sound.0.stop();
commands.entity(sound.1).despawn();
}

commands.spawn(AudioBundle {
source: sounds.game_over.clone(),
settings: PlaybackSettings::DESPAWN,
Expand Down

0 comments on commit 9fa7ecd

Please sign in to comment.