diff --git a/assets/Banjo.ogg b/assets/Banjo.ogg new file mode 100644 index 0000000..9cbd7a2 Binary files /dev/null and b/assets/Banjo.ogg differ diff --git a/assets/test.png b/assets/test.png deleted file mode 100644 index 796c92b..0000000 Binary files a/assets/test.png and /dev/null differ diff --git a/src/game_state.rs b/src/game_state.rs index c089326..d317694 100644 --- a/src/game_state.rs +++ b/src/game_state.rs @@ -2,13 +2,17 @@ use bevy::prelude::*; use std::f64::consts::PI; use rand::seq::SliceRandom; use rand::RngCore; + use crate::Player; use crate::GameState; use crate::MainGame; use crate::Sky; use crate::ConstellationLine; +use crate::PlayerState; + use crate::celestial_to_cartesian; use crate::spawn_cons_lines; + use crate::NORMAL_BUTTON; use crate::RIGHT_BUTTON; use crate::WRONG_BUTTON; @@ -22,6 +26,9 @@ pub struct HealthLabel; #[derive(Component)] pub struct ScoreLabel; +#[derive(Component)] +pub struct HintLabel; + pub fn setup(mut commands: Commands, _asset_server: Res) { // Create a container node that places its children (buttons) at the bottom of the screen let container_node = NodeBundle { @@ -116,7 +123,7 @@ pub fn setup(mut commands: Commands, _asset_server: Res) { ..label_style.clone() }, text: Text::from_section( - "0000", // Text content + "0", // Text content TextStyle { // font: asset_server.load("fonts/FiraSans-Bold.ttf"), font_size: 30.0, @@ -127,9 +134,40 @@ pub fn setup(mut commands: Commands, _asset_server: Res) { ..default() }; + // Centered container for the "Hint" label + let centered_container_node = NodeBundle { + style: Style { + position_type: PositionType::Absolute, + width: Val::Percent(100.0), // Full width + top: Val::Px(20.0), // Positioned at the top + justify_content: JustifyContent::Center, // Center horizontally + align_items: AlignItems::Center, // Center vertically + ..default() + }, + ..default() + }; + + // Hint label + let hint_label_node = TextBundle::from_section( + "hint", + TextStyle { + // font: asset_server.load("fonts/FiraSans-Bold.ttf"), + font_size: 20.0, + color: Color::srgb(0.7, 0.7, 0.7), + ..default() + }, + ); + // Spawn the top left and top right labels commands.spawn((top_left_label_node, MainGame, HealthLabel)); commands.spawn((top_right_label_node, MainGame, ScoreLabel)); + + // Create a parent container and then spawn the hint label inside it + let centered_container = commands.spawn(centered_container_node).id(); + let hint_label = commands.spawn((hint_label_node, MainGame, HintLabel)).id(); + + commands.entity(centered_container).push_children(&[hint_label]); + } @@ -141,7 +179,9 @@ pub fn player_interact( button_query: Query<(&mut BackgroundColor, &mut BorderColor), With