Skip to content

Commit

Permalink
Do not spawn antidote sound when immunity is prolonged
Browse files Browse the repository at this point in the history
  • Loading branch information
tehlers committed Feb 8, 2025
1 parent 979a87c commit 6c1223f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/game/systems/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,15 +440,17 @@ pub fn eat(
if *antidote_pos == head_pos.to_position() {
commands.entity(ent).despawn();

if head.immunity.finished() {
commands.spawn((
AudioPlayer(sounds.antidote.clone()),
PlaybackSettings::LOOP,
AntidoteSound,
OnGameScreen,
));
}

let remaining = head.immunity.remaining_secs();
head.immunity = Timer::from_seconds(10.0 + remaining, TimerMode::Once);

commands.spawn((
AudioPlayer(sounds.antidote.clone()),
PlaybackSettings::LOOP,
AntidoteSound,
OnGameScreen,
));
}
}

Expand Down

0 comments on commit 6c1223f

Please sign in to comment.