From d3ff454ecfeda98d7f7862f5eb8c84c4875fa519 Mon Sep 17 00:00:00 2001 From: PraxTube Date: Tue, 31 Oct 2023 14:44:24 +0100 Subject: [PATCH] feat: Add matchmaking screen loading animation --- Cargo.lock | 2 +- src/player/mod.rs | 2 +- src/ui/matchmaking_screen.rs | 62 +++++++++++++++++++++++++++++++----- 3 files changed, 56 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2ef2dfb..f74d8ad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -73,7 +73,7 @@ dependencies = [ [[package]] name = "ace-of-the-heavens" -version = "0.2.1" +version = "0.2.2" dependencies = [ "bevy", "bevy_asset_loader", diff --git a/src/player/mod.rs b/src/player/mod.rs index eb76ffa..d1f97d4 100644 --- a/src/player/mod.rs +++ b/src/player/mod.rs @@ -17,7 +17,7 @@ use crate::world::Rematch; use crate::RollbackState; // Movement -pub const MIN_SPEED: f32 = 000.0 / 60.0; +pub const MIN_SPEED: f32 = 200.0 / 60.0; pub const DELTA_SPEED: f32 = 75.0 / 60.0 / 100.0; pub const DELTA_STEERING: f32 = 3.5 / 60.0; // Collision diff --git a/src/ui/matchmaking_screen.rs b/src/ui/matchmaking_screen.rs index 081a57b..6121d14 100644 --- a/src/ui/matchmaking_screen.rs +++ b/src/ui/matchmaking_screen.rs @@ -4,6 +4,8 @@ use crate::{GameAssets, GameState}; #[derive(Component)] struct MatchmakingScreen; +#[derive(Component)] +struct MatchmakingText; fn spawn_title_text(commands: &mut Commands, font: Handle) -> Entity { let text_style = TextStyle { @@ -11,12 +13,9 @@ fn spawn_title_text(commands: &mut Commands, font: Handle) -> Entity { font_size: 75.0, color: Color::WHITE, }; - let text_bundle = TextBundle::from_sections([TextSection::new( - "WAITING FOR 1 OTHER PLAYER...".to_string(), - text_style, - )]) - .with_text_alignment(TextAlignment::Center); - commands.spawn(text_bundle).id() + let text_bundle = + TextBundle::from_sections([TextSection::new("LOADING -".to_string(), text_style)]); + commands.spawn((MatchmakingText, text_bundle)).id() } fn spawn_quit_text(commands: &mut Commands, font: Handle) -> Entity { @@ -70,11 +69,58 @@ fn despawn_matchmaking_screen( } } +fn animate_matchmaking_screen( + mut query: Query<&mut Text, With>, + mut ticks: Local, + mut forward: Local, + time: Res