Browse Source

Neue Änderungen HA09

master
Jannik Niebuhr 2 years ago
parent
commit
1684df7cbf
  1. 1264
      spaceinvaders/GameProject/log/log4j.log
  2. 21
      spaceinvaders/GameProject/src/playground/BreakoutLevel3.java

1264
spaceinvaders/GameProject/log/log4j.log
File diff suppressed because it is too large
View File

21
spaceinvaders/GameProject/src/playground/BreakoutLevel3.java

@ -1,24 +1,24 @@
package playground; package playground;
import java.awt.Color; import java.awt.Color;
import gameobjects.*; import gameobjects.*;
import java.*;
public class BreakoutLevel3 extends BreakoutLevel2 { public class BreakoutLevel3 extends BreakoutLevel2 {
@Override @Override
public void prepareLevel(String level) { public void prepareLevel(String level) {
this.setLevelFlag("points", 0); this.setLevelFlag("points", 0);
this.setGlobalFlag("lives", 3);
super.setGlobalFlag("lives", 3);
TextObject points = new TextObject("Counter", this, 50D, 10D, 0D, 0D, "Points: "+ this.getLevelFlag("points").toString(), 20, Color.BLACK); TextObject points = new TextObject("Counter", this, 50D, 10D, 0D, 0D, "Points: "+ this.getLevelFlag("points").toString(), 20, Color.BLACK);
this.addObject(points); this.addObject(points);
TextObject lives = new TextObject ("Counter2", this, 600D, 10D, 0D, 0D, "Lives: "+ this.getGlobalFlag("lives").toString(), 20, Color.GREEN);
TextObject lives = new TextObject("Counter2", this, 600D, 10D, 0D, 0D, "Lives: "+ super.getGlobalFlag("lives").toString(), 20, Color.GREEN);
this.addObject(lives); this.addObject(lives);
super.prepareLevel(level); super.prepareLevel(level);
} }
@ -33,17 +33,12 @@ public class BreakoutLevel3 extends BreakoutLevel2 {
@Override @Override
public void applyGameLogic() { public void applyGameLogic() {
super.applyGameLogic(); super.applyGameLogic();
if(this.ball.getY() < this.ego.getY()) {
int newLives = Integer.valueOf(this.getGlobalFlag("lives").toString()) - 1;
this.setGlobalFlag("points", newLives);
this.addObject(new TextObject ("Counter2", this, 600D, 10D, 0D, 0D, "Lives: "+ this.getGlobalFlag("lives").toString(), 20, Color.GREEN));
if(ball.getY() > ego.getY()) {
int newLives = Integer.valueOf(super.getGlobalFlag("lives").toString()) - 1;
super.setGlobalFlag("newLives", newLives);
this.addObject(new TextObject("Counter2", this, 600D, 10D, 0D, 0D, "Lives: "+ super.getGlobalFlag("newLives").toString(), 20, Color.GREEN));
} }
} }
} }
Loading…
Cancel
Save