This commit is contained in:
parent
fc95857824
commit
6a151397de
7 changed files with 21 additions and 1 deletions
|
@ -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>>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue