diff --git a/src/play.rs b/src/play.rs index 2c5b65f..a2b6d3c 100644 --- a/src/play.rs +++ b/src/play.rs @@ -33,6 +33,14 @@ pub(crate) fn toggle_selected( } } +pub(crate) fn reset_rotation( + trigger: Trigger, + mut transforms: Query<&mut Transform>, +) { + let mut t = transforms.get_mut(trigger.entity()).unwrap(); + t.rotation = Quat::default(); +} + pub(crate) fn check_set(_trigger: Trigger>, query: Query<&Card, With>) { let mut cards = query.iter(); if cards.len() == 3 { diff --git a/src/setup.rs b/src/setup.rs index 43b01ed..1fa3873 100644 --- a/src/setup.rs +++ b/src/setup.rs @@ -43,6 +43,7 @@ pub(crate) fn setup_cards(mut commands: Commands, deck: Res) { .spawn((new_this, this_card, t)) .observe(debug::set_debug_card) .observe(debug::hide_debug_card) + .observe(play::reset_rotation) .observe(play::toggle_selected); }); } @@ -62,14 +63,24 @@ pub(crate) fn setup_camera(mut commands: Commands) { pub(crate) struct CheckSet; pub(crate) fn setup_set_check_button(mut commands: Commands) { - commands.spawn(Node::default()).with_children(|parent| { - parent - .spawn((Button, CheckSet, BackgroundColor(TEAL.into()))) - .with_children(|parent| { - parent.spawn(Text("Set!?".to_string())); - }) - .observe(play::check_set); - }); + commands + .spawn(( + Node { + width: Val::Percent(100.0), + flex_direction: FlexDirection::Column, + align_items: AlignItems::Center, + ..default() + }, + BackgroundColor(Color::BLACK.with_alpha(0.8).into()), + )) + .with_children(|parent| { + parent + .spawn((Button, CheckSet, BackgroundColor(TEAL.into()))) + .with_children(|parent| { + parent.spawn(Text("Set!?".to_string())); + }) + .observe(play::check_set); + }); } /// Finish the setup state by progressing to the play state