create_entities: Remove from MainScene struct
This commit is contained in:
parent
51a3f812fe
commit
5d4048d9a7
1 changed files with 49 additions and 52 deletions
|
@ -138,7 +138,7 @@ impl AsScene for MainScene {
|
|||
.chain(),
|
||||
);
|
||||
world.insert_resource(Timer::new());
|
||||
Self::create_entities(world, 100, 10.0, 10.0);
|
||||
create_entities(world, 100, 10.0, 10.0);
|
||||
|
||||
self.state = Some(MainSceneState {
|
||||
square,
|
||||
|
@ -370,14 +370,12 @@ impl AsScene for MainScene {
|
|||
}
|
||||
}
|
||||
|
||||
impl MainScene {
|
||||
// Function to create entities in the ECS world
|
||||
fn create_entities(
|
||||
fn create_entities(
|
||||
world: &mut World,
|
||||
num_instances: u32,
|
||||
instance_size: f32,
|
||||
instance_spacing: f32,
|
||||
) {
|
||||
) {
|
||||
let num_instances_per_row = (num_instances as f32 / instance_spacing).ceil() as u32;
|
||||
|
||||
let square_instances = (0..num_instances)
|
||||
|
@ -430,7 +428,6 @@ impl MainScene {
|
|||
.collect::<Vec<_>>();
|
||||
|
||||
world.spawn_batch(cube_instances);
|
||||
}
|
||||
}
|
||||
|
||||
fn update_velocity_system(mut query: Query<(&mut Transform, &Velocity)>, time: Res<Timer>) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue