Skip to content

Commit

Permalink
fix bug in timer usage [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
bbarker committed Dec 11, 2023
1 parent 59314a2 commit e6dc444
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,19 @@ fn click_play_button(
),
(Changed<Interaction>, With<Button>),
>,
timer_query: Query<&GameTimer>,
mut commands: Commands,
) {
for (interaction, mut color, button_colors, change_state, open_link) in &mut interaction_query {
match *interaction {
Interaction::Pressed => {
if let Some(state) = change_state {
commands.spawn(GameTimer {
time: 600.,
is_active: true,
});
if timer_query.is_empty() {
commands.spawn(GameTimer {
time: 600.,
is_active: true,
});
};
next_state.set(state.0.clone());
commands.spawn(ChangeState(GameState::Playing));
} else if let Some(link) = open_link {
Expand Down
2 changes: 1 addition & 1 deletion src/ui_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct HudData {
}

#[derive(Component)]
struct Hud {}
pub struct Hud {}

#[allow(clippy::too_many_arguments)]
fn render_ui(
Expand Down

0 comments on commit e6dc444

Please sign in to comment.