diff --git a/src/resources/sound_effects.rs b/src/resources/sound_effects.rs index d9a9286..58d2576 100644 --- a/src/resources/sound_effects.rs +++ b/src/resources/sound_effects.rs @@ -34,6 +34,7 @@ pub struct SoundEffects { pub blocked: SoundSamples, pub whipping: SoundSamples, pub whipping_hit: SoundSamples, + pub whipping_hit_end: SoundSamples, rng: RandomNumberGenerator, } @@ -125,6 +126,12 @@ impl SoundEffects { }, ], }), + whipping_hit_end: ss.render_sound_effect(&SoundEffect { + sounds: vec![Sound { + sound_type: SoundType::Tone(400), + duration: Duration::from_millis(20), + }], + }), rng: RandomNumberGenerator::new(), } } diff --git a/src/systems/whip_system.rs b/src/systems/whip_system.rs index d22c764..3b17ac5 100644 --- a/src/systems/whip_system.rs +++ b/src/systems/whip_system.rs @@ -87,9 +87,14 @@ impl<'a> System<'a> for WhipSystem { if let Some(sound) = &mut wants_to_whip.sound { sound.control::, _>().stop(); } - wants_to_whip.sound = Some( - sound_output.play_sound(sound_effects.whipping_hit.clone()), - ); + if wants_to_whip.frame == 7 { + wants_to_whip.sound = None; + sound_output.play_sound(sound_effects.whipping_hit_end.clone()); + } else { + wants_to_whip.sound = Some( + sound_output.play_sound(sound_effects.whipping_hit.clone()), + ); + } } } }