diff --git a/core/src/com/me/asteroids/systems/CollisionSystem.java b/core/src/com/me/asteroids/systems/CollisionSystem.java index 7e06a88..4982802 100644 --- a/core/src/com/me/asteroids/systems/CollisionSystem.java +++ b/core/src/com/me/asteroids/systems/CollisionSystem.java @@ -23,7 +23,7 @@ public class CollisionSystem extends EntitySystem { Entity[] entities = getEntities().items; for (int i = 0, n = getEntities().size; i < n-1; i++) { Entity entityA = entities[i]; - if (!entityA.isActive() || entityA.isRemoved()) { + if (!entityA.isActive()) { continue; } @@ -31,7 +31,7 @@ public class CollisionSystem extends EntitySystem { for (int j = i + 1; j < n; j++) { Entity entityB = entities[j]; - if (!entityB.isActive() || entityB.isRemoved()) { + if (!entityB.isActive()) { continue; } diff --git a/core/src/com/me/common/ecs/Entity.java b/core/src/com/me/common/ecs/Entity.java index e7d975a..dd79c83 100644 --- a/core/src/com/me/common/ecs/Entity.java +++ b/core/src/com/me/common/ecs/Entity.java @@ -50,6 +50,7 @@ public final class Entity { public void remove() { removed = true; + active = false; refresh(); } diff --git a/core/src/com/me/common/ecs/EntitySystem.java b/core/src/com/me/common/ecs/EntitySystem.java index a5b4170..5c71ccf 100644 --- a/core/src/com/me/common/ecs/EntitySystem.java +++ b/core/src/com/me/common/ecs/EntitySystem.java @@ -29,7 +29,7 @@ public abstract class EntitySystem extends BaseSystem { public void process(float dt) { for (int i = 0, n = entities.size; i < n; i++) { Entity entity = entities.items[i]; - if (!entity.removed && entity.active) { + if (entity.isActive()) { processEntity(entity, dt); } }