diff --git a/docs/design.md b/docs/design.md index 8596511..84008b7 100644 --- a/docs/design.md +++ b/docs/design.md @@ -309,7 +309,6 @@ pub enum Screen { Splash, Loading, Title, - Credits, Gameplay, Victory, Leaderboard, diff --git a/src/lib.rs b/src/lib.rs index da23fd1..63f483c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -103,9 +103,6 @@ fn spawn_camera(mut commands: Commands) { } fn load_background(mut commands: Commands) { - #[cfg(feature = "dev")] - let colorcheme = rose_pine::RosePine::Base; - #[cfg(not(feature = "dev"))] let colorcheme = rose_pine::RosePineDawn::Base; commands.insert_resource(ClearColor(colorcheme.to_color())); } diff --git a/src/player/systems/input.rs b/src/player/systems/input.rs index 74f81f6..5c0e5af 100644 --- a/src/player/systems/input.rs +++ b/src/player/systems/input.rs @@ -222,6 +222,7 @@ impl From for EdgeDirection { direction.rotate_cw(0) } } + #[cfg(test)] mod tests { use super::*; diff --git a/src/screens/credits.rs b/src/screens/credits.rs deleted file mode 100644 index 44c23d8..0000000 --- a/src/screens/credits.rs +++ /dev/null @@ -1,71 +0,0 @@ -//! A credits screen that can be accessed from the title screen. - -use bevy::prelude::*; - -use crate::{asset_tracking::LoadResource, audio::Music, screens::Screen, theme::prelude::*}; - -pub(super) fn plugin(app: &mut App) { - app.add_systems(OnEnter(Screen::Credits), spawn_credits_screen); - - app.load_resource::(); - app.add_systems(OnEnter(Screen::Credits), play_credits_music); - app.add_systems(OnExit(Screen::Credits), stop_music); -} - -fn spawn_credits_screen(mut commands: Commands) { - commands - .ui_root() - .insert(StateScoped(Screen::Credits)) - .with_children(|children| { - children.header("Made by"); - children.label("Joe Shmoe - Implemented aligator wrestling AI"); - children.label("Jane Doe - Made the music for the alien invasion"); - - children.header("Assets"); - children.label("Bevy logo - All rights reserved by the Bevy Foundation. Permission granted for splash screen use when unmodified."); - children.label("Ducky sprite - CC0 by Caz Creates Games"); - children.label("Button SFX - CC0 by Jaszunio15"); - children.label("Music - CC BY 3.0 by Kevin MacLeod"); - - children.button("Back").observe(enter_title_screen); - }); -} - -fn enter_title_screen(_trigger: Trigger, mut next_screen: ResMut>) { - next_screen.set(Screen::Title); -} - -#[derive(Resource, Asset, Reflect, Clone)] -pub struct CreditsMusic { - #[dependency] - music: Handle, - entity: Option, -} - -impl FromWorld for CreditsMusic { - fn from_world(world: &mut World) -> Self { - let assets = world.resource::(); - Self { - music: assets.load("audio/music/Monkeys Spinning Monkeys.ogg"), - entity: None, - } - } -} - -fn play_credits_music(mut commands: Commands, mut music: ResMut) { - music.entity = Some( - commands - .spawn(( - AudioPlayer::(music.music.clone()), - PlaybackSettings::LOOP, - Music, - )) - .id(), - ); -} - -fn stop_music(mut commands: Commands, mut music: ResMut) { - if let Some(entity) = music.entity.take() { - commands.entity(entity).despawn_recursive(); - } -} diff --git a/src/screens/loading.rs b/src/screens/loading.rs index 556c9a4..ebfdc2f 100644 --- a/src/screens/loading.rs +++ b/src/screens/loading.rs @@ -4,7 +4,7 @@ use bevy::prelude::*; use crate::{ - screens::{credits::CreditsMusic, gameplay::GameplayMusic, Screen}, + screens::{gameplay::GameplayMusic, Screen}, theme::{interaction::InteractionAssets, prelude::*}, }; @@ -35,8 +35,7 @@ fn continue_to_title_screen(mut next_screen: ResMut>) { const fn all_assets_loaded( interaction_assets: Option>, - credits_music: Option>, gameplay_music: Option>, ) -> bool { - interaction_assets.is_some() && credits_music.is_some() && gameplay_music.is_some() + interaction_assets.is_some() && gameplay_music.is_some() } diff --git a/src/screens/mod.rs b/src/screens/mod.rs index 13606fd..df0e70d 100644 --- a/src/screens/mod.rs +++ b/src/screens/mod.rs @@ -1,6 +1,5 @@ //! The game's main screen states and transitions between them. -mod credits; mod gameplay; mod loading; mod splash; @@ -13,7 +12,6 @@ pub(super) fn plugin(app: &mut App) { app.enable_state_scoped_entities::(); app.add_plugins(( - credits::plugin, gameplay::plugin, loading::plugin, splash::plugin, @@ -29,6 +27,5 @@ pub enum Screen { #[cfg_attr(feature = "dev", default)] Loading, Title, - Credits, Gameplay, } diff --git a/src/screens/title.rs b/src/screens/title.rs index 9b0457d..c56bba4 100644 --- a/src/screens/title.rs +++ b/src/screens/title.rs @@ -14,7 +14,6 @@ fn spawn_title_screen(mut commands: Commands) { .insert(StateScoped(Screen::Title)) .with_children(|children| { children.button("Play").observe(enter_gameplay_screen); - children.button("Credits").observe(enter_credits_screen); #[cfg(not(target_family = "wasm"))] children.button("Exit").observe(exit_app); @@ -25,10 +24,6 @@ fn enter_gameplay_screen(_trigger: Trigger, mut next_screen: ResMut, mut next_screen: ResMut>) { - next_screen.set(Screen::Credits); -} - #[cfg(not(target_family = "wasm"))] fn exit_app(_trigger: Trigger, mut app_exit: EventWriter) { app_exit.send(AppExit::Success);