From eb21aae334f29506fdf5a8fadf0ac1f0029ed0d3 Mon Sep 17 00:00:00 2001 From: jkonert Date: Fri, 22 Apr 2022 21:07:36 +0200 Subject: [PATCH] cleanup and small code changes for first code homework --- GameProject/src/playground/Level4.java | 4 ++-- GameProject/src/playground/LevelBoss.java | 4 ++-- .../{HitTwiceLevel.java => LevelHitTwice.java} | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) rename GameProject/src/playground/{HitTwiceLevel.java => LevelHitTwice.java} (87%) diff --git a/GameProject/src/playground/Level4.java b/GameProject/src/playground/Level4.java index 06443e0..cfb39b3 100644 --- a/GameProject/src/playground/Level4.java +++ b/GameProject/src/playground/Level4.java @@ -38,10 +38,10 @@ public class Level4 extends SpaceInvadersLevel { if (counter >= MAX_HITS) { logger.trace("enemy was hit before for " + counter + " times, which is above " - + HitTwiceLevel.MAX_HITS); + + LevelHitTwice.MAX_HITS); super.actionIfEnemyIsHit(e, shot); } else { - logger.trace("enemy was hit before for "+counter+" times, which is below "+HitTwiceLevel.MAX_HITS); + logger.trace("enemy was hit before for "+counter+" times, which is below "+LevelHitTwice.MAX_HITS); e.setObjectFlag("counter", Integer.valueOf(counter + 1)); // spawn a bonus points object double vx = 2 * (Math.random() - 0.5) * SHARDSPEED + e.getVX(); diff --git a/GameProject/src/playground/LevelBoss.java b/GameProject/src/playground/LevelBoss.java index c68e2bd..abff08d 100644 --- a/GameProject/src/playground/LevelBoss.java +++ b/GameProject/src/playground/LevelBoss.java @@ -37,11 +37,11 @@ public class LevelBoss extends SpaceInvadersLevel { if (counter >= LevelBoss.MAX_SHOTS) { logger.trace("enemy was hit before for " + counter + " times, which is equal or above " - + HitTwiceLevel.MAX_HITS); + + LevelHitTwice.MAX_HITS); super.actionIfEnemyIsHit(e, shot); } else { logger.trace("enemy was hit before for " + counter + " times, which is below " - + HitTwiceLevel.MAX_HITS); + + LevelHitTwice.MAX_HITS); e.setObjectFlag("counter", Integer.valueOf(counter + 1)); } deleteObject(shot.getId()); diff --git a/GameProject/src/playground/HitTwiceLevel.java b/GameProject/src/playground/LevelHitTwice.java similarity index 87% rename from GameProject/src/playground/HitTwiceLevel.java rename to GameProject/src/playground/LevelHitTwice.java index a1a233e..1243f1f 100644 --- a/GameProject/src/playground/HitTwiceLevel.java +++ b/GameProject/src/playground/LevelHitTwice.java @@ -17,15 +17,15 @@ import org.apache.logging.log4j.Logger; */ -public class HitTwiceLevel extends SpaceInvadersLevel { +public class LevelHitTwice extends SpaceInvadersLevel { /** constant defining the number of shots needed to destroy an enemy */ public static final int MAX_HITS = 2; - private static Logger logger = LogManager.getLogger(HitTwiceLevel.class); + private static Logger logger = LogManager.getLogger(LevelHitTwice.class); /** constructor setting internal name to 'hitTwice' */ - public HitTwiceLevel() { + public LevelHitTwice() { super(); this.level = "hitTwice"; } @@ -59,10 +59,10 @@ public class HitTwiceLevel extends SpaceInvadersLevel { if (counter >= MAX_HITS) { logger.trace("enemy was hit before for " + counter + " times, which is above " - + HitTwiceLevel.MAX_HITS); + + LevelHitTwice.MAX_HITS); super.actionIfEnemyIsHit(e, shot); } else { - logger.trace("enemy was hit before for "+counter+" times, which is below "+HitTwiceLevel.MAX_HITS); + logger.trace("enemy was hit before for "+counter+" times, which is below "+LevelHitTwice.MAX_HITS); e.setObjectFlag("counter", Integer.valueOf(counter + 1)); } deleteObject(shot.getId());