Autoformat to make the checker happy
Some checks failed
Basic checks / Basic build-and-test supertask (push) Failing after 44s

This commit is contained in:
2025-02-01 17:28:37 -06:00
parent c86cd0d642
commit 406e611e31

View File

@@ -9,29 +9,25 @@ pub struct AsteroidPlugin;
impl Plugin for AsteroidPlugin { impl Plugin for AsteroidPlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
app.add_systems( app.add_systems(Startup, (spawn_camera, spawn_player, spawn_ui))
Startup, .insert_resource(ClearColor(BACKGROUND_COLOR))
(spawn_camera, spawn_player, spawn_ui), .insert_resource(WorldSize {
) width: WINDOW_SIZE.x,
.insert_resource(ClearColor(BACKGROUND_COLOR)) height: WINDOW_SIZE.y,
.insert_resource(WorldSize { })
width: WINDOW_SIZE.x, .insert_resource(Lives(3))
height: WINDOW_SIZE.y, .insert_resource(Score(0))
}) .add_systems(
.insert_resource(Lives(3)) FixedUpdate,
.insert_resource(Score(0)) (input_ship_thruster, input_ship_rotation, wrap_entities)
.add_systems( .run_if(in_state(GameState::Playing)),
FixedUpdate, )
(input_ship_thruster, input_ship_rotation, wrap_entities).run_if(in_state(GameState::Playing)), .add_systems(
) FixedPostUpdate,
.add_systems( (integrate_velocity, update_positions, apply_rotation_to_mesh)
FixedPostUpdate, .run_if(in_state(GameState::Playing)),
(integrate_velocity, update_positions, apply_rotation_to_mesh).run_if(in_state(GameState::Playing)), )
) .add_systems(OnEnter(GameState::TitleScreen), start_screen);
.add_systems(
OnEnter(GameState::TitleScreen),
start_screen
);
app.insert_state(GameState::TitleScreen); app.insert_state(GameState::TitleScreen);
} }
@@ -39,10 +35,10 @@ impl Plugin for AsteroidPlugin {
#[derive(Clone, Debug, Eq, Hash, PartialEq, States)] #[derive(Clone, Debug, Eq, Hash, PartialEq, States)]
enum GameState { enum GameState {
TitleScreen, // Program is started. Present title screen and await user start TitleScreen, // Program is started. Present title screen and await user start
GetReady, // Short timer to let the player get ready after pressing start GetReady, // Short timer to let the player get ready after pressing start
Playing, // Player has started the game. Run the main loop Playing, // Player has started the game. Run the main loop
GameOver, // Game has ended. Present game over dialogue and await user restart GameOver, // Game has ended. Present game over dialogue and await user restart
} }
#[derive(Component)] #[derive(Component)]
@@ -259,7 +255,7 @@ fn spawn_ui(mut commands: Commands, score: Res<Score>, lives: Res<Lives>) {
font_size: 25.0, font_size: 25.0,
..default() ..default()
}, },
) ),
])); ]));
} }
@@ -284,4 +280,4 @@ fn start_screen(mut commands: Commands) {
]) ])
.with_text_justify(bevy::text::JustifyText::Center), .with_text_justify(bevy::text::JustifyText::Center),
)); ));
} }