Skip to content

Commit

Permalink
make dead screen
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinmorrow committed Mar 6, 2024
1 parent 21355ea commit 492184e
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 16 deletions.
2 changes: 0 additions & 2 deletions src/components.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
pub mod character;
pub mod collect_coin;
pub mod damage;
pub mod dead_screen_plugin;
pub mod health;
pub mod jump;
pub mod kills_player;
Expand All @@ -14,7 +13,6 @@ impl bevy::prelude::Plugin for ComponentsPlugin {
app.add_plugins((
character::CharacterPlugin,
kills_player::KillsPlayerPlugin,
dead_screen_plugin::DeadScreenPlugin,
npc_movement::NpcMovementPlugin,
player_win::PlayerWinPlugin,
damage::DamagePlugin,
Expand Down
14 changes: 0 additions & 14 deletions src/components/dead_screen_plugin.rs

This file was deleted.

41 changes: 41 additions & 0 deletions src/dead_screen.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
use bevy::prelude::*;

use crate::state::GameState;

pub struct DeadScreenPlugin;
impl Plugin for DeadScreenPlugin {
fn build(&self, app: &mut App) {
app.add_systems(OnEnter(GameState::Dead), setup);
}
}

fn setup(mut commands: Commands) {
commands
.spawn(NodeBundle {
style: Style {
width: Val::Percent(100.0),
height: Val::Percent(100.0),
..default()
},
background_color: BackgroundColor(Color::Hsla {
hue: 0.0,
saturation: 0.0,
lightness: 0.0,
alpha: 0.5,
}),
..default()
})
.with_children(|parent| {
parent.spawn(TextBundle {
text: Text::from_section(
"You died. Sorry!",
TextStyle {
font_size: 100.0,
color: Color::WHITE,
..default()
},
),
..default()
});
});
}
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::state::GameState;
mod bundles;
mod camera;
mod components;
mod dead_screen;
mod level;
mod start_screen;
mod state;
Expand Down Expand Up @@ -38,6 +39,7 @@ pub fn start_app() {
InputManagerPlugin::<components::character::Action>::default(),
camera::CameraPlugin,
start_screen::StartScreenPlugin,
dead_screen::DeadScreenPlugin,
bundles::player::PlayerPlugin,
level::LevelPlugin,
components::ComponentsPlugin,
Expand Down

0 comments on commit 492184e

Please sign in to comment.