Browse Source

HA04 finished

main
Nico B 2 years ago
parent
commit
01bb10e5dc
  1. 15
      GameProject/src/base/MultiLevelGame.java
  2. 30
      GameProject/src/playground/LevelWithBox.java
  3. 3
      GameProject/src/playground/Playground.java

15
GameProject/src/base/MultiLevelGame.java

@ -2,13 +2,7 @@ package base;
import java.io.IOException;
import playground.Level1;
import playground.Level3;
import playground.Level5;
import playground.Level6;
import playground.Level7;
import playground.LevelBoss;
import playground.LevelHitTwice;
import playground.*;
public class MultiLevelGame extends GameLoop {
@ -27,9 +21,10 @@ public class MultiLevelGame extends GameLoop {
//this.addLevel(new Level3());
//this.addLevel(new LevelBoss());
this.addLevel(new Level5());
this.addLevel(new Level6());
this.addLevel(new Level7());
//this.addLevel(new Level5());
//this.addLevel(new Level6());
//this.addLevel(new Level7());
this.addLevel(new LevelWithBox());
}

30
GameProject/src/playground/LevelWithBox.java

@ -0,0 +1,30 @@
package playground;
import java.awt.Color;
import gameobjects.*;
/** This class adds a new level to the game.
*
* @author team22
*/
public class LevelWithBox extends SpaceInvadersLevel {
/** This method overrides the initial method and adds a red rectangle on the top which does not do anything.
*
* @param id String identifies level
*/
@Override
public void prepareLevel(String id) {
super.prepareLevel(id);
RectObject rectangle = new RectObject("rectangle", this, 350, 100, 0, 0, 700, 250, Color.RED);
addObject(rectangle);
}
/** This method overrides the initial method to change the startup message.
*
* @return String Startup message
*/
@Override
protected String getStartupMessage() {
return "Box-Level!";
}
}

3
GameProject/src/playground/Playground.java

@ -81,6 +81,7 @@ public abstract class Playground {
public void addObjectNow(GameObject o) {
gameObjects.put(o.getId(), o);
}
/**
@ -109,6 +110,7 @@ public abstract class Playground {
}
return l;
};
/**
@ -275,7 +277,6 @@ public abstract class Playground {
return this.mouseEvents;
}
/**
* Method meant to be filled with own code, handles the entore game logic (collision checks, timed
* events, ...).

Loading…
Cancel
Save