Use the lifetime limiters on Bullets & Asteroids
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:
2025-08-10 17:13:25 -05:00
parent 2f463303a0
commit 364fbd7530
3 changed files with 9 additions and 4 deletions

View File

@@ -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)),
));
}
}