game end
This commit is contained in:
parent
e68420b6ef
commit
b7ec46493e
4 changed files with 21 additions and 7 deletions
|
|
@ -1,8 +1,12 @@
|
|||
use bevy::{ecs::system::SystemParam, prelude::*};
|
||||
use bevy_kira_audio::prelude::*;
|
||||
|
||||
use crate::core::{
|
||||
kirby::Kirby,
|
||||
wave::{BubbleWaves, EnnemyWaveLock},
|
||||
use crate::{
|
||||
core::{
|
||||
kirby::Kirby,
|
||||
wave::{BubbleWaves, EnnemyWaveLock},
|
||||
},
|
||||
juice::sound::{Background, Poyoo},
|
||||
};
|
||||
|
||||
#[derive(Event)]
|
||||
|
|
@ -69,12 +73,21 @@ fn on_reset_world(
|
|||
#[derive(Event)]
|
||||
struct ResetWorldEvent;
|
||||
|
||||
fn on_end_game(event: On<EndGameEvent>, mut commands: Commands) {
|
||||
fn on_end_game(
|
||||
event: On<EndGameEvent>,
|
||||
mut commands: Commands,
|
||||
background_audio: Res<AudioChannel<Background>>,
|
||||
poyo_audio: Res<AudioChannel<Poyoo>>,
|
||||
asset_server: Res<AssetServer>,
|
||||
) {
|
||||
let reason = event.reason;
|
||||
println!("end game reason {:?}", reason);
|
||||
|
||||
if reason == EndGameReason::Victory {
|
||||
panic!("You win! But you panic still");
|
||||
background_audio.stop();
|
||||
poyo_audio.play(asset_server.load("sounds/kirby-poyo.ogg"));
|
||||
background_audio.play(asset_server.load("sounds/end_goffy.ogg"));
|
||||
return;
|
||||
}
|
||||
commands.trigger(ResetWorldEvent);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,8 +89,8 @@ fn get_bubble_waves() -> BubbleWaves {
|
|||
],
|
||||
vec![
|
||||
BubbleSplash::new(NORMAL_BUBBLE, RIGHT - UP_DIR * 20.0, 100.0, 200),
|
||||
BubbleSplash::new(RED_BUBBLE, RIGHT + UP_DIR * 20.0, 100.0, 100),
|
||||
BubbleSplash::new(RED_BUBBLE, LEFT, 100.0, 100),
|
||||
BubbleSplash::new(RED_BUBBLE, RIGHT + TOP, 100.0, 100),
|
||||
BubbleSplash::new(RED_BUBBLE, LEFT + TOP, 100.0, 100),
|
||||
],
|
||||
vec![
|
||||
BubbleSplash::new(NORMAL_BUBBLE, RIGHT, 100.0, 200),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue