Use the lifetime limiters on Bullets & Asteroids
All checks were successful
Basic checks / Basic build-and-test supertask (push) Successful in 7m3s
All checks were successful
Basic checks / Basic build-and-test supertask (push) Successful in 7m3s
Closes #14 Despawn bullets to limit range. Despawn asteroids to limit random garbage floating around the scene.
This commit is contained in:
@@ -7,7 +7,7 @@ use std::time::Duration;
|
||||
|
||||
use bevy::prelude::*;
|
||||
|
||||
use crate::{GameAssets, WorldSize, physics::Velocity};
|
||||
use crate::{GameAssets, Lifetime, WorldSize, config::ASTEROID_LIFETIME, physics::Velocity};
|
||||
|
||||
#[derive(Component, Deref, DerefMut)]
|
||||
pub struct Asteroid(AsteroidSize);
|
||||
@@ -124,6 +124,7 @@ pub fn spawn_asteroid(
|
||||
Velocity(spawn.vel),
|
||||
Mesh2d(mesh),
|
||||
MeshMaterial2d(material),
|
||||
Lifetime(Timer::from_seconds(ASTEROID_LIFETIME, TimerMode::Once)),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user