Browse Source

Solved HA06 - Tasks 03 & 04

(solved bug with Logger and made new enemies immortal)
master
fdai7303 3 years ago
parent
commit
e000585d1f
  1. 10
      GameProject/src/playground/LevelMovingHitObjects.java

10
GameProject/src/playground/LevelMovingHitObjects.java

@ -2,8 +2,9 @@ package playground;
import java.awt.Color;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.*;
import base.MovingObjectsGame;
import collider.RectCollider;
import gameobjects.GameObject;
import gameobjects.RectObject;
@ -17,7 +18,8 @@ public class LevelMovingHitObjects extends SpaceInvadersLevel {
RectObject fly_enemy1 = new RectObject("fly_enemy1", this, 300, 300, 75, 40, 40, 40, Color.BLUE);
RectObject fly_enemy2 = new RectObject("fly_enemy2", this, 200, 200, 20, 90, 40, 40, Color.GREEN);
// FIXME add logger here
static org.apache.logging.log4j.Logger logger = LogManager.getLogger(SpaceInvadersLevel.class);
//static org.apache.logging.log4j.Logger logger = LogManager.getLogger(SpaceInvadersLevel.class);
private static Logger logger = LogManager.getLogger(LevelMovingHitObjects.class.getName());
//FIXME add your method overrides here
@ -57,7 +59,11 @@ public class LevelMovingHitObjects extends SpaceInvadersLevel {
logger.info("normal objects hit");
super.actionIfEgoCollidesWithEnemy(enemy, ego);
}
}
@Override
void actionIfEnemyIsHit(GameObject e, GameObject shot) {
deleteObject(shot.getId());
}

Loading…
Cancel
Save