create_entities: Remove from MainScene struct

This commit is contained in:
Florian RICHER 2025-06-12 21:11:17 +02:00
parent 51a3f812fe
commit 5d4048d9a7
Signed by: florian.richer
GPG key ID: C73D37CBED7BFC77

View file

@ -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>) {