diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f6554b..b3c663e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Spawn enemies at random distance and direction from player +- Limit total concurrent enemies to 10 - Decrease static orbit scale (planets are now closer) - Clamp orbit distance (prevents Moon orbiting inside of Earth sprite) - Indicators spawn on update allowing new entities to be pointed to diff --git a/src/ships/enemy.rs b/src/ships/enemy.rs index f4d493e..a6a6188 100644 --- a/src/ships/enemy.rs +++ b/src/ships/enemy.rs @@ -86,11 +86,12 @@ pub(crate) fn spawn_enemies( sprites: Res, mut spawn_timer: ResMut, player_position: Query<&Transform, With>, + enemies: Query<&Enemy>, ) { // tick the timer spawn_timer.0.tick(time.delta()); - if spawn_timer.0.finished() { + if spawn_timer.0.finished() && enemies.iter().count() < 10 { let Ok(from) = player_position.get_single() else { return; };