Add function documentation
All checks were successful
CI / Formatting (push) Successful in 1m30s

This commit is contained in:
Michael Bradley 2025-05-19 22:19:04 -04:00
parent fc95857824
commit 6a151397de
Signed by: MichaelBradley
SSH key fingerprint: SHA256:BKO2eI2LPsCbQS3n3i5SdwZTAIV3F1lHezR07qP+Ob0
7 changed files with 21 additions and 1 deletions

View file

@ -20,12 +20,15 @@ const BALL_COUNT: u8 = 32;
const BALL_SIZES: Range<f32> = 10.0..25.0;
const DIMENSION_SIZES: Range<f32> = 500.0..2000.0;
/// The size of the playable area (x, y)
#[derive(Resource)]
pub struct PlayableArea(f32, f32);
/// The size of the player character
#[derive(Resource)]
pub struct PlayerSize(f32);
/// Initialize deterministic values
pub fn setup_pseudo_random(mut commands: Commands, mut rng: GlobalEntropy<WyRand>) {
commands.insert_resource(PlayerSize(rng.random_range(BALL_SIZES)));
commands.insert_resource(PlayableArea(
@ -38,6 +41,7 @@ pub fn setup_ui(mut commands: Commands) {
commands.spawn((Name::new("Camera"), Camera2d, IsDefaultUiCamera));
}
/// Create the playable character
pub fn setup_player(
mut commands: Commands,
mut materials: ResMut<Assets<ColorMaterial>>,
@ -53,6 +57,7 @@ pub fn setup_player(
));
}
/// Create a random distribution of balls in the playable area
pub fn setup_balls(
mut commands: Commands,
mut materials: ResMut<Assets<ColorMaterial>>,
@ -76,6 +81,7 @@ pub fn setup_balls(
}
}
/// Create the 4 walls that enclose the playable area
pub fn setup_walls(
mut commands: Commands,
mut materials: ResMut<Assets<ColorMaterial>>,