diff --git a/source/core/src/main/com/csse3200/game/entities/EntityService.java b/source/core/src/main/com/csse3200/game/entities/EntityService.java index c8c8823df..9c20b93d4 100644 --- a/source/core/src/main/com/csse3200/game/entities/EntityService.java +++ b/source/core/src/main/com/csse3200/game/entities/EntityService.java @@ -85,7 +85,9 @@ public Array getEntities() { public Array getNearbyEntities(Entity source, float radius) { Array nearbyEntities = new Array(); Array allEntities = ServiceLocator.getEntityService().getEntities(); - for (Entity otherEntity : allEntities) { + for (int i = 0; i < allEntities.size; i++) { + Entity otherEntity = allEntities.get(i); + if (source == otherEntity) continue; // Skip the source entity Vector2 positionSource = source.getPosition();