Skip to content

Commit

Permalink
flame updete first
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaVentu03 committed Jul 5, 2024
1 parent 04fff02 commit 20c7074
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,16 @@ public void updateGame(final long elapsed) {
ce.checkCharacterCollision(player, this.getGameMap());
ce.checkFlameAndPowerUpCollision(player, this.getGameMap());
}
if (!boombs.isEmpty()) {
boombs.entrySet().forEach(entry -> entry.getKey().update());
placeBombExplosion();
}
if (!flames.isEmpty()) {
flames.forEach(f -> f.update(elapsed));
flames.stream().filter(f -> f.isExpired())
.forEach(f -> map.removeFlame(f.getPos()));
flames.removeIf(f -> f.isExpired());
}
if (!boombs.isEmpty()) {
boombs.entrySet().forEach(entry -> entry.getKey().update());
placeBombExplosion();
}
enemies.forEach(enemy -> {
if (enemy.isAlive()) {
enemy.update(this, elapsed);
Expand All @@ -112,11 +112,10 @@ public void updateGame(final long elapsed) {
}
if (!flames.isEmpty()) {
flames.forEach(f -> f.update(elapsed));
List.copyOf(flames)
.stream()
flames.stream()
.filter(f -> f.isExpired())
.peek(f -> flames.remove(f))
.forEach(f -> map.removeFlame(f.getPos()));
flames.removeIf(f -> f.isExpired());
}
}

Expand Down

0 comments on commit 20c7074

Please sign in to comment.