diff --git a/README.md b/README.md index 58a330a..c511357 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,6 @@ * (?) can jump only from a surface (no mid-air jump) * (?) multiplayer * make WASM build work again (replace hanabi) -* Text is not displayed after menu (on win state and on game over level) * level reset ## Build diff --git a/assets/Cantarell-VF.otf b/assets/Cantarell-VF.otf deleted file mode 100644 index 7306325..0000000 Binary files a/assets/Cantarell-VF.otf and /dev/null differ diff --git a/assets/UacariLegacy-Thin.ttf b/assets/UacariLegacy-Thin.ttf new file mode 100644 index 0000000..c3de821 Binary files /dev/null and b/assets/UacariLegacy-Thin.ttf differ diff --git a/src/game.rs b/src/game.rs index bdd90aa..b85a065 100644 --- a/src/game.rs +++ b/src/game.rs @@ -223,7 +223,6 @@ fn collision_event_system( if app_state.current() == &AppState::Game && 4. - new_color.length_squared() < 0.1 { - println!("win"); app_state.replace(AppState::Win).ok(); } @@ -326,22 +325,22 @@ fn keyboard_input_system( } } -// TODO: the text is not visible, I don't know why. fn win_setup(mut commands: Commands, asset_server: Res) { - println!("win system"); - let font = asset_server.get_handle("Cantarell-VF.otf"); - commands.spawn_bundle(Text2dBundle { - text: Text::from_section( - "Press ENTER to level up", - TextStyle { - font, - font_size: 32.0, - color: Color::WHITE, - }, - ) - .with_alignment(TextAlignment::CENTER), - ..Default::default() - }); + let font = asset_server.get_handle("UacariLegacy-Thin.ttf"); + commands + .spawn_bundle(Text2dBundle { + text: Text::from_section( + "Press ENTER to level up", + TextStyle { + font, + font_size: 32.0, + color: Color::WHITE, + }, + ) + .with_alignment(TextAlignment::CENTER), + ..Default::default() + }) + .insert(Level); } // Sounds diff --git a/src/levels/game_over.rs b/src/levels/game_over.rs index d46c2bf..f03026d 100644 --- a/src/levels/game_over.rs +++ b/src/levels/game_over.rs @@ -3,7 +3,7 @@ use crate::game::*; use bevy::prelude::*; pub fn setup(commands: &mut Commands, asset_server: &Res) { - let font = asset_server.get_handle("Cantarell-VF.otf"); + let font = asset_server.get_handle("UacariLegacy-Thin.ttf"); commands .spawn_bundle(Text2dBundle { text: Text::from_section( @@ -15,7 +15,7 @@ pub fn setup(commands: &mut Commands, asset_server: &Res) { }, ) .with_alignment(TextAlignment::CENTER), - transform: Transform::from_xyz(0., -128.0, 0.), + transform: Transform::from_xyz(0., 128.0, 0.), ..Default::default() }) .insert(Level); diff --git a/src/main.rs b/src/main.rs index d2d072d..02c2c62 100644 --- a/src/main.rs +++ b/src/main.rs @@ -33,6 +33,7 @@ fn main() { .add_plugin(RapierDebugRenderPlugin::default()) .add_plugin(menu::MenuPlugin) .add_plugin(game::GamePlugin) + .add_plugin(bevy_inspector_egui::WorldInspectorPlugin::new()) .add_startup_system(setup) .run(); } @@ -42,7 +43,8 @@ fn setup( mut dsp_manager: ResMut, asset_server: Res, ) { - let _font: Handle = asset_server.load("Cantarell-VF.otf"); + let font: Handle = asset_server.load("UacariLegacy-Thin.ttf"); + commands.insert_resource(font); commands.spawn_bundle(Camera2dBundle { camera_2d: Camera2d { diff --git a/src/menu.rs b/src/menu.rs index 02058b8..52bcdb9 100644 --- a/src/menu.rs +++ b/src/menu.rs @@ -8,7 +8,7 @@ use bevy::{ pub struct MenuPlugin; #[derive(Component)] -struct Menu(); +struct Menu; impl Plugin for MenuPlugin { fn build(&self, app: &mut App) { @@ -19,7 +19,7 @@ impl Plugin for MenuPlugin { } fn setup(mut commands: Commands, asset_server: Res) { - let font = asset_server.get_handle("Cantarell-VF.otf"); + let font = asset_server.get_handle("UacariLegacy-Thin.ttf"); commands .spawn_bundle(Text2dBundle { text: Text::from_section( @@ -31,10 +31,10 @@ fn setup(mut commands: Commands, asset_server: Res) { }, ) .with_alignment(TextAlignment::CENTER), - transform: Transform::from_xyz(0., -128.0, 0.), + transform: Transform::from_xyz(0., 128.0, 0.), ..Default::default() }) - .insert(Menu()); + .insert(Menu); commands .spawn_bundle(Text2dBundle { text: Text::from_section( @@ -48,7 +48,7 @@ fn setup(mut commands: Commands, asset_server: Res) { .with_alignment(TextAlignment::CENTER), ..Default::default() }) - .insert(Menu()); + .insert(Menu); } fn despawn(mut commands: Commands, menu_query: Query>) {