Skip to content

Commit

Permalink
Changed interator in getNearbyEntites to for loop because team 2 said…
Browse files Browse the repository at this point in the history
… it was breaking somewhere
  • Loading branch information
gregchan550 committed Sep 6, 2023
1 parent 6a3ae93 commit a752e90
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ public Array<Entity> getEntities() {
public Array<Entity> getNearbyEntities(Entity source, float radius) {
Array<Entity> nearbyEntities = new Array<Entity>();
Array<Entity> 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();
Expand Down

0 comments on commit a752e90

Please sign in to comment.