clicking start removes the menu

main
Jordan Orelli 12 months ago
parent 75d4c6919a
commit 37cd9ddae5

@ -5,6 +5,9 @@ use tracing::info;
pub struct StartMenu {}
#[derive(Component)]
struct MainMenu;
#[derive(Component)]
struct InactiveColor(Color);
@ -68,10 +71,17 @@ fn hover_colors(
}
}
fn click_play(mut actions: Query<&Interaction, (Changed<Interaction>, With<PlayButton>)>) {
fn click_play(
mut actions: Query<&Interaction, (Changed<Interaction>, With<PlayButton>)>,
menu: Query<Entity, With<MainMenu>>,
mut commands: Commands,
) {
for interaction in &mut actions {
if matches!(interaction, Interaction::Pressed) {
todo!()
info!("Play button clicked");
for m in menu.iter() {
commands.entity(m).despawn_recursive();
}
}
}
}
@ -145,7 +155,7 @@ fn setup(mut commands: Commands) {
let green = Color::rgb(0.2, 0.8, 0.2);
commands.spawn(Camera2dBundle::default());
commands.spawn(column()).with_children(|menu| {
commands.spawn((MainMenu, column())).with_children(|menu| {
menu.spawn(vertical_spacer(80.0));
menu.spawn((Title, title_text()));
menu.spawn(vertical_spacer(32.0));

Loading…
Cancel
Save