Browse Source

Nacharbeiten HA6

Logger ergänzt
master
Alisa95 3 years ago
parent
commit
82241a5a71
  1. BIN
      .DS_Store
  2. 8
      prog2-codebase/GameProject/bin/.gitignore
  3. BIN
      spaceinvaders/.DS_Store
  4. BIN
      spaceinvaders/GameProject/.DS_Store
  5. 7
      spaceinvaders/GameProject/bin/.gitignore
  6. 2
      spaceinvaders/GameProject/bin/log4j2.xml
  7. BIN
      spaceinvaders/GameProject/lib/.DS_Store
  8. 2
      spaceinvaders/GameProject/src/log4j2.xml
  9. 7
      spaceinvaders/GameProject/src/playground/LevelMovingHitObjects.java

BIN
.DS_Store

8
prog2-codebase/GameProject/bin/.gitignore

@ -0,0 +1,8 @@
/base/
/collider/
/controller/
/gameobjects/
/log4j2.xml
/playground/
/rendering/
/ui/

BIN
spaceinvaders/.DS_Store

BIN
spaceinvaders/GameProject/.DS_Store

7
spaceinvaders/GameProject/bin/.gitignore

@ -1 +1,8 @@
/base/
/collider/
/controller/
/gameobjects/
/log4j2.xml
/playground/ /playground/
/rendering/
/ui/

2
spaceinvaders/GameProject/bin/log4j2.xml

@ -20,7 +20,7 @@
<appender-ref ref="File" /> <appender-ref ref="File" />
</root> </root>
<Logger name="base.GameLoop" level="info">
<Logger name="playground.LevelMovingHitObjects" level="trace">
</Logger> </Logger>
<Logger name="playground" level="info"> <Logger name="playground" level="info">

BIN
spaceinvaders/GameProject/lib/.DS_Store

2
spaceinvaders/GameProject/src/log4j2.xml

@ -20,7 +20,7 @@
<appender-ref ref="File" /> <appender-ref ref="File" />
</root> </root>
<Logger name="base.GameLoop" level="info">
<Logger name="playground.LevelMovingHitObjects" level="trace">
</Logger> </Logger>
<Logger name="playground" level="info"> <Logger name="playground" level="info">

7
spaceinvaders/GameProject/src/playground/LevelMovingHitObjects.java

@ -26,7 +26,7 @@ public class LevelMovingHitObjects extends SpaceInvadersLevel {
@Override @Override
public void prepareLevel(String id) { public void prepareLevel(String id) {
super.prepareLevel(id); super.prepareLevel(id);
Logger.trace("Creating and adding two RectObjects with Collider");
blueBox = new RectObject("fly_enemy1", this, 300, 300, 75, 40, 40, 40, Color.BLUE); blueBox = new RectObject("fly_enemy1", this, 300, 300, 75, 40, 40, 40, Color.BLUE);
this.addObject(blueBox); this.addObject(blueBox);
ReboundController boxControl = new ReboundController(); ReboundController boxControl = new ReboundController();
@ -40,15 +40,18 @@ public class LevelMovingHitObjects extends SpaceInvadersLevel {
greenBox.addController(boxControl_2); greenBox.addController(boxControl_2);
RectCollider colliderGreen = new RectCollider("ColliderGreen", greenBox, 40, 40); RectCollider colliderGreen = new RectCollider("ColliderGreen", greenBox, 40, 40);
greenBox.addCollider(colliderGreen); greenBox.addCollider(colliderGreen);
Logger.debug("successfully finished prepareLevel with two RectObjects");
} }
@Override @Override
void actionIfEgoCollidesWithEnemy(GameObject enemy, GameObject ego) { void actionIfEgoCollidesWithEnemy(GameObject enemy, GameObject ego) {
super.actionIfEgoCollidesWithEnemy(enemy, ego);
if(enemy.id.contains("fly")) { if(enemy.id.contains("fly")) {
this.lost = true; this.lost = true;
Playground.setGlobalFlag("egoLives", 0); Playground.setGlobalFlag("egoLives", 0);
Logger.info("ego hit a letal RectObject. Game ends NOW"); Logger.info("ego hit a letal RectObject. Game ends NOW");
} else {
Logger.debug("ego hit one of the other aliens, calling parent class code");
super.actionIfEgoCollidesWithEnemy(enemy, ego);
HighscoreManager.writeHSToFile((Integer) Playground.getGlobalFlag("points"), HighscoreManager.writeHSToFile((Integer) Playground.getGlobalFlag("points"),
(Integer) Playground.getGlobalFlag("highscore")); (Integer) Playground.getGlobalFlag("highscore"));

Loading…
Cancel
Save