fn handle_back(
    mut state: ResMut<State<GameState>>,
    mut interaction_query: Query<&Interaction, (Changed<Interaction>, With<BackButton>)>,
) {
    for interaction in interaction_query.iter_mut() {
        match *interaction {
            Interaction::Clicked => {
                state
                    .set(GameState::Menu)
                    .expect("Failed to reset the game state");
                break;
            }
            _ => {}
        }
    }
}
/// Checks if the [BackButton] was pressed and brings the user to
/// the difficulty selection menu.
Checks if the [BackButton] was pressed and brings the user to
the difficulty selection menu.
Checks if the [ BackButton ] was pressed and brings the user to the difficulty selection menu .
fn handle_back(
    mut state: ResMut<State<GameState>>,
    mut interaction_query: Query<&Interaction, (Changed<Interaction>, With<BackButton>)>,
) {
    for interaction in interaction_query.iter_mut() {
        match *interaction {
            Interaction::Clicked => {
                state
                    .set(GameState::Menu)
                    .expect("Failed to reset the game state");
                break;
            }
            _ => {}
        }
    }
}
fn handle_back ( mut state : ResMut < State < GameState > > , mut interaction_query : Query < & Interaction , ( Changed < Interaction > , With < BackButton > ) > , ) { for interaction in interaction_query . iter_mut ( ) { match * interaction { Interaction :: Clicked => { state . set ( GameState :: Menu ) . expect ( " " ) ; break ; } _ => { } } } }
Checks if the [BackButton] was pressed and brings the user to
the difficulty selection menu.
Checks if the [ BackButton ] was pressed and brings the user to the difficulty selection menu .
state
ResMut<State<GameState>>
interaction_query
Query<&Interaction, (Changed<Interaction>, With<BackButton>)>
state
ResMut<State<GameState>>
interaction_query
Query<&Interaction, (Changed<Interaction>, With<BackButton>)>