Browse Source

Hausaufgabe 5 Anfang

main
Manu 3 years ago
parent
commit
211cbafbd7
  1. 3
      GameProject/src/base/GameLoop.java
  2. 3
      GameProject/src/base/MultiLevelGame.java
  3. 9
      GameProject/src/playground/LevelMovingObjects.java
  4. 3
      GameProject/src/playground/LevelWithBox.java

3
GameProject/src/base/GameLoop.java

@ -8,6 +8,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import gameobjects.GameObject;
import playground.Level1;
import playground.LevelMovingObjects;
import playground.LevelWithBox;
import playground.Playground;
import ui.GameUI;
@ -56,7 +57,7 @@ public class GameLoop {
*/
void defineLevels() {
this.resetLevels();
this.addLevel(new LevelWithBox());
this.addLevel(new LevelMovingObjects());
}
/**

3
GameProject/src/base/MultiLevelGame.java

@ -3,13 +3,14 @@ package base;
import java.io.IOException;
import playground.Level5;
import playground.LevelMovingObjects;
import playground.LevelWithBox;
public class MultiLevelGame extends GameLoop {
void defineLevels() {
this.addLevel(new LevelWithBox());
this.addLevel(new LevelMovingObjects());
}

9
GameProject/src/playground/LevelMovingObjects.java

@ -1,12 +1,19 @@
package playground;
import java.awt.Color;
import gameobjects.RectObject;
/** This level adds two distracting objects to the canvas that cannot collide but bounce around all the time.
*/
public class LevelMovingObjects extends SpaceInvadersLevel {
// TODO your code here
public void prepareLevel(String id) {
super.prepareLevel(id);
LevelMovingObjects ml = this;
RectObject object2 = new RectObject(id +"Bluebox",ml,300,300,170,70,30,30,Color.BLUE);
this.addObject(object2);
}
/** "Moving Objects Level!" is the message.

3
GameProject/src/playground/LevelWithBox.java

@ -25,7 +25,8 @@ public class LevelWithBox extends SpaceInvadersLevel {
public void prepareLevel(String id) {
super.prepareLevel(id);
RectObject Object = new RectObject(id,null,350,100,0,0,700,250,Color.RED);
LevelWithBox myLevel = this;
RectObject Object = new RectObject(id,myLevel,350,100,0,0,700,250,Color.RED);
this.addObject(Object);
}

Loading…
Cancel
Save