From 23a61fe2fb539765319f20947a8277bf26c4bdd4 Mon Sep 17 00:00:00 2001 From: Jacopo Turchi Date: Fri, 5 Jul 2024 11:43:27 +0200 Subject: [PATCH] Modified methods order --- .../core/impl/BasicBombarderoGameManager.java | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/main/java/it/unibo/bombardero/core/impl/BasicBombarderoGameManager.java b/src/main/java/it/unibo/bombardero/core/impl/BasicBombarderoGameManager.java index be6603d9..e63c0a2c 100644 --- a/src/main/java/it/unibo/bombardero/core/impl/BasicBombarderoGameManager.java +++ b/src/main/java/it/unibo/bombardero/core/impl/BasicBombarderoGameManager.java @@ -71,9 +71,9 @@ public BasicBombarderoGameManager( * * The argument passed can be passed to the synchronous entities * to synchronize them to the game's time. @@ -88,15 +88,6 @@ 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)); - List.copyOf(flames).stream().filter(f -> f.isExpired()).peek(f -> flames.remove(f)) - .forEach(f -> map.removeFlame(f.getPos())); - } enemies.forEach(enemy -> { if (enemy.isAlive()) { enemy.update(this, elapsed); @@ -105,6 +96,18 @@ public void updateGame(final long elapsed) { ce.checkFlameAndPowerUpCollision(enemy, this.getGameMap()); } }); + if (!boombs.isEmpty()) { + boombs.entrySet().forEach(entry -> entry.getKey().update()); + placeBombExplosion(); + } + if (!flames.isEmpty()) { + flames.forEach(f -> f.update(elapsed)); + List.copyOf(flames) + .stream() + .filter(f -> f.isExpired()) + .peek(f -> flames.remove(f)) + .forEach(f -> map.removeFlame(f.getPos())); + } } private void addCharacterBombsToMap(final Character character) {