game end
This commit is contained in:
parent
e68420b6ef
commit
b7ec46493e
4 changed files with 21 additions and 7 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,2 +1,3 @@
|
||||||
/target
|
/target
|
||||||
.cargo
|
.cargo
|
||||||
|
/web
|
||||||
|
|
|
||||||
BIN
assets/sounds/end_goffy.ogg
Normal file
BIN
assets/sounds/end_goffy.ogg
Normal file
Binary file not shown.
|
|
@ -1,8 +1,12 @@
|
||||||
use bevy::{ecs::system::SystemParam, prelude::*};
|
use bevy::{ecs::system::SystemParam, prelude::*};
|
||||||
|
use bevy_kira_audio::prelude::*;
|
||||||
|
|
||||||
use crate::core::{
|
use crate::{
|
||||||
|
core::{
|
||||||
kirby::Kirby,
|
kirby::Kirby,
|
||||||
wave::{BubbleWaves, EnnemyWaveLock},
|
wave::{BubbleWaves, EnnemyWaveLock},
|
||||||
|
},
|
||||||
|
juice::sound::{Background, Poyoo},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Event)]
|
#[derive(Event)]
|
||||||
|
|
@ -69,12 +73,21 @@ fn on_reset_world(
|
||||||
#[derive(Event)]
|
#[derive(Event)]
|
||||||
struct ResetWorldEvent;
|
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;
|
let reason = event.reason;
|
||||||
println!("end game reason {:?}", reason);
|
println!("end game reason {:?}", reason);
|
||||||
|
|
||||||
if reason == EndGameReason::Victory {
|
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);
|
commands.trigger(ResetWorldEvent);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,8 +89,8 @@ fn get_bubble_waves() -> BubbleWaves {
|
||||||
],
|
],
|
||||||
vec![
|
vec![
|
||||||
BubbleSplash::new(NORMAL_BUBBLE, RIGHT - UP_DIR * 20.0, 100.0, 200),
|
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, RIGHT + TOP, 100.0, 100),
|
||||||
BubbleSplash::new(RED_BUBBLE, LEFT, 100.0, 100),
|
BubbleSplash::new(RED_BUBBLE, LEFT + TOP, 100.0, 100),
|
||||||
],
|
],
|
||||||
vec![
|
vec![
|
||||||
BubbleSplash::new(NORMAL_BUBBLE, RIGHT, 100.0, 200),
|
BubbleSplash::new(NORMAL_BUBBLE, RIGHT, 100.0, 200),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue