Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Instructions Screen #189

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions crates/thetawave_interface/src/states.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ pub enum AppStates {
#[default]
LoadingAssets,
MainMenu,
Instructions,
CharacterSelection,
InitializeRun,
Game,
Expand Down Expand Up @@ -36,8 +35,5 @@ pub struct VictoryCleanup;
#[derive(Component)]
pub struct PauseCleanup;

#[derive(Component)]
pub struct InstructionsCleanup;

#[derive(Component)]
pub struct CharacterSelectionCleanup;
2 changes: 1 addition & 1 deletion crates/thetawave_storage/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ mod test {
}

fn set_dummy_terminal_game_state(mut s: ResMut<NextState<AppStates>>) {
(*s).set(AppStates::Instructions);
(*s).set(AppStates::CharacterSelection);
}

fn clear_completed_games_metrics(
Expand Down
20 changes: 0 additions & 20 deletions src/states/game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,3 @@ pub(super) fn start_game_system(
});
}
}

pub(super) fn start_character_selection_system(
menu_input_query: Query<&ActionState<MenuAction>, With<MenuExplorer>>,
mut next_app_state: ResMut<NextState<AppStates>>,
mut sound_effect_pub: EventWriter<PlaySoundEffectEvent>,
) {
// read menu input action
let action_state = menu_input_query.single();

// if input read enter the game state
if action_state.just_released(&MenuAction::Confirm) {
// set the state to game
next_app_state.set(AppStates::CharacterSelection);

// play sound effect
sound_effect_pub.send(PlaySoundEffectEvent {
sound_effect_type: SoundEffectType::MenuInputSuccess,
});
}
}
13 changes: 1 addition & 12 deletions src/states/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use thetawave_interface::input::MenuExplorer;
use thetawave_interface::states::CharacterSelectionCleanup;
use thetawave_interface::states::GameCleanup;
use thetawave_interface::states::GameOverCleanup;
use thetawave_interface::states::InstructionsCleanup;
use thetawave_interface::states::MainMenuCleanup;
use thetawave_interface::states::PauseCleanup;
use thetawave_interface::states::VictoryCleanup;
Expand All @@ -34,7 +33,7 @@ use crate::assets::UiAssets;
use crate::GameEnterSet;
use crate::GameUpdateSet;

use self::game::{start_character_selection_system, start_game_system};
use self::game::start_game_system;
use self::pause_menu::{close_pause_menu_system, open_pause_menu_system};
/// Includes systems that handle state transitions for `AppStates` and `GameStates`. Also includes
/// an asset loading state.
Expand Down Expand Up @@ -115,11 +114,6 @@ impl Plugin for StatesPlugin {
.run_if(in_state(GameStates::Playing)),
);

app.add_systems(
Update,
start_character_selection_system.run_if(in_state(AppStates::Instructions)),
);

app.add_systems(
Update,
start_game_system.run_if(in_state(AppStates::CharacterSelection)),
Expand Down Expand Up @@ -152,11 +146,6 @@ impl Plugin for StatesPlugin {
clear_state_system::<PauseCleanup>,
);

app.add_systems(
OnExit(AppStates::Instructions),
clear_state_system::<InstructionsCleanup>,
);

app.add_systems(
Update,
close_pause_menu_system.run_if(in_state(GameStates::Paused)),
Expand Down
85 changes: 0 additions & 85 deletions src/ui/instructions.rs

This file was deleted.

14 changes: 7 additions & 7 deletions src/ui/main_menu/button.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Provides the layout (trait on `bevy::hierarchy::ChildBUilder`) and behavior (systems) to put 4
//! vertically layed out on the main menu, and change the state from
//! `thetawave_interface::states::AppStates::MainMenu` to
//! `thetawave_interface::states::AppStates::Instructions`
//! `thetawave_interface::states::AppStates::CharacterSelection`
use crate::assets::UiAssets;
use bevy::{
app::AppExit,
Expand Down Expand Up @@ -44,11 +44,11 @@ const BUTTON_TEXTURE_PADDING_HOVERED: UiRect =
UiRect::new(Val::ZERO, Val::ZERO, Val::Percent(10.5), Val::ZERO);

/// Event and Component for giving and sending menu buttons actions to move the user from
/// `AppStates::MainMenu` to `AppStates::Instructions`, plus possibly a few digressions and
/// `AppStates::MainMenu` to `AppStates::CharacterSelection`, plus possibly a few digressions and
/// sprinkles.
#[derive(Component, Event, Clone, PartialEq, Eq, Copy, Debug)]
pub(super) enum MainMenuButtonActionComponent {
EnterInstructions,
EnterCharacterSelection,
EnterOptions,
EnterCompendium,
QuitGame,
Expand All @@ -59,7 +59,7 @@ impl MainMenuButtonActionComponent {
/// option/action
fn in_game_text(&self) -> &'static str {
match self {
Self::EnterInstructions => "Start Game",
Self::EnterCharacterSelection => "Start Game",
Self::EnterOptions => "Options",
Self::EnterCompendium => "Compendium",
Self::QuitGame => "Exit Game",
Expand All @@ -68,7 +68,7 @@ impl MainMenuButtonActionComponent {
}
/// This is the order (vertical, going down) of the buttons shown on the main menu UI.
const MAIN_MENU_BUTTON_ORDER: [MainMenuButtonActionComponent; 4] = [
MainMenuButtonActionComponent::EnterInstructions,
MainMenuButtonActionComponent::EnterCharacterSelection,
MainMenuButtonActionComponent::EnterOptions,
MainMenuButtonActionComponent::EnterCompendium,
MainMenuButtonActionComponent::QuitGame,
Expand Down Expand Up @@ -368,8 +368,8 @@ pub(super) fn main_menu_button_on_click_system(
) {
for event in button_event_reader.read() {
match event {
MainMenuButtonActionComponent::EnterInstructions => {
next_app_state.set(AppStates::Instructions);
MainMenuButtonActionComponent::EnterCharacterSelection => {
next_app_state.set(AppStates::CharacterSelection);
}
MainMenuButtonActionComponent::EnterOptions => info!("Enter options menu."),
MainMenuButtonActionComponent::EnterCompendium => info!("Enter compendium."),
Expand Down
4 changes: 2 additions & 2 deletions src/ui/main_menu/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! Exposes a plugin to handle the layout and behavior of a button-based main menu that mainly
//! guides the user into the `thetawave_interface::states::AppStates::Instructions` state.
//! guides the user into the `thetawave_interface::states::AppStates::CharacterSelection` state.
use crate::{
animation::{AnimationComponent, AnimationDirection},
assets::UiAssets,
Expand Down Expand Up @@ -30,7 +30,7 @@ use self::button::main_menu_button_selection_and_click_system;
use self::button::MainMenuButtonActionEvent;
use self::button::UiChildBuilderExt;
/// Renders a button-based UI to transition the app from `AppStates::MainMenu` to
/// `AppStates::Instructions`, possibly with some digressions. Without this plugin, the game will
/// `AppStates::CharacterSelection`, possibly with some digressions. Without this plugin, the game will
/// never progress past a blank main menu screen and the user cannot start the run.
pub(super) struct MainMenuUIPlugin;
impl Plugin for MainMenuUIPlugin {
Expand Down
7 changes: 0 additions & 7 deletions src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use thetawave_interface::states;
mod character_selection;
mod game;
mod game_over;
mod instructions;
mod main_menu;
mod pause_menu;
mod victory;
Expand All @@ -24,7 +23,6 @@ use self::{
},
game::GameUiPlugin,
game_over::setup_game_over_system,
instructions::setup_instructions_system,
main_menu::MainMenuUIPlugin,
pause_menu::setup_pause_system,
victory::setup_victory_system,
Expand All @@ -41,11 +39,6 @@ impl Plugin for UiPlugin {
app.add_plugins(MainMenuUIPlugin);
app.add_systems(Update, bouncing_prompt_system);

app.add_systems(
OnEnter(states::AppStates::Instructions),
setup_instructions_system,
);

app.add_systems(
OnEnter(states::AppStates::CharacterSelection),
setup_character_selection_system,
Expand Down
Loading