Browse Source

Solved Hausaufgabe 4 added LevelWithBox

master
Emma Nagelschmidt 2 years ago
parent
commit
6a6f8cc445
  1. 2
      GameProject/src/base/MultiLevelGame.java
  2. 30
      GameProject/src/playground/LevelWithBox.java

2
GameProject/src/base/MultiLevelGame.java

@ -9,12 +9,14 @@ import playground.Level6;
import playground.Level7;
import playground.LevelBoss;
import playground.LevelHitTwice;
import playground.LevelWithBox;
public class MultiLevelGame extends GameLoop{
@Override
void defineLevels() {
this.resetLevels();
this.addLevel(new LevelWithBox());
this.addLevel(new Level5());
this.addLevel(new Level6());
this.addLevel(new Level7());

30
GameProject/src/playground/LevelWithBox.java

@ -0,0 +1,30 @@
package playground;
import java.awt.Color;
import gameobjects.RectObject;
/**
* Class LevelWithBox creates level with red box at the top.
* Red box is called "Red Box".
* @author 26
*/
public class LevelWithBox extends SpaceInvadersLevel {
/** Method creates red Box at the top in level LevelWithBox.
* @param id String a string identifying the level number etc
*/
@Override
public void prepareLevel(String id) {
super.prepareLevel(id);
addObject(new RectObject("Red Box", this, 350, 100, 0, 0, 700, 250, Color.RED));
}
/** Method shows message at the start of LevelWithBox.
* @return String start message
*/
@Override
protected String getStartupMessage() {
return "Box-Level!";
}
}
Loading…
Cancel
Save