game end
All checks were successful
Build Bevy Game (Linux + Windows) / build-windows (push) Successful in 19m19s
Build Bevy Game (Linux + Windows) / build-linux (push) Successful in 19m47s

This commit is contained in:
Crizomb 2026-01-09 02:01:11 +01:00
parent e68420b6ef
commit b7ec46493e
4 changed files with 21 additions and 7 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
/target
.cargo
/web

BIN
assets/sounds/end_goffy.ogg Normal file

Binary file not shown.

View file

@ -1,8 +1,12 @@
use bevy::{ecs::system::SystemParam, prelude::*};
use bevy_kira_audio::prelude::*;
use crate::core::{
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);
}

View file

@ -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),