|
@ -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 */ |
|
|
/** constant defining the number of shots needed to destroy an enemy */ |
|
|
public static final int MAX_HITS = 2; |
|
|
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' */ |
|
|
/** constructor setting internal name to 'hitTwice' */ |
|
|
public HitTwiceLevel() { |
|
|
|
|
|
|
|
|
public LevelHitTwice() { |
|
|
super(); |
|
|
super(); |
|
|
this.level = "hitTwice"; |
|
|
this.level = "hitTwice"; |
|
|
} |
|
|
} |
|
@ -59,10 +59,10 @@ public class HitTwiceLevel extends SpaceInvadersLevel { |
|
|
|
|
|
|
|
|
if (counter >= MAX_HITS) { |
|
|
if (counter >= MAX_HITS) { |
|
|
logger.trace("enemy was hit before for " + counter + " times, which is above " |
|
|
logger.trace("enemy was hit before for " + counter + " times, which is above " |
|
|
+ HitTwiceLevel.MAX_HITS); |
|
|
|
|
|
|
|
|
+ LevelHitTwice.MAX_HITS); |
|
|
super.actionIfEnemyIsHit(e, shot); |
|
|
super.actionIfEnemyIsHit(e, shot); |
|
|
} else { |
|
|
} 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)); |
|
|
e.setObjectFlag("counter", Integer.valueOf(counter + 1)); |
|
|
} |
|
|
} |
|
|
deleteObject(shot.getId()); |
|
|
deleteObject(shot.getId()); |