diff --git a/GameProject/src/base/BreakoutGame.java b/GameProject/src/base/BreakoutGame.java
index 2c636ff..d9cc8b5 100644
--- a/GameProject/src/base/BreakoutGame.java
+++ b/GameProject/src/base/BreakoutGame.java
@@ -19,7 +19,7 @@ public class BreakoutGame extends GameLoop {
@Override
public void defineLevels() {
this.resetLevels(); // removes Level1 added by superclass constructor
- // this.addLevel(new BreakoutLevel1()); // FIXME add this as soon as your level exists
+ this.addLevel(new BreakoutLevel1()); // FIXME add this as soon as your level exists
}
/**
diff --git a/GameProject/src/log4j2.xml b/GameProject/src/log4j2.xml
index 6e39401..9db2129 100644
--- a/GameProject/src/log4j2.xml
+++ b/GameProject/src/log4j2.xml
@@ -20,7 +20,7 @@
-
+
diff --git a/GameProject/src/playground/BreakoutLevel1.java b/GameProject/src/playground/BreakoutLevel1.java
new file mode 100644
index 0000000..d885188
--- /dev/null
+++ b/GameProject/src/playground/BreakoutLevel1.java
@@ -0,0 +1,117 @@
+package playground;
+
+import java.awt.Color;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import collider.RectCollider;
+import controller.EgoController;
+import controller.ReboundController2;
+import gameobjects.FallingStar;
+import gameobjects.GameObject;
+import gameobjects.RectObject;
+
+/**
+ * Class that generates a level with one egoObject, ball and ten bricks which need to be destroyed with the ball.
+ */
+
+
+public class BreakoutLevel1 extends BreakoutLevelBase {
+
+
+ private static Logger logger2 = LogManager.getLogger(BreakoutLevel1.class);
+
+ /**
+ * This method defines the behavior when the ball hits a brick. It allows the ball to destroy the brick and move on in opposite direction.
+ *
+ * @param ball GameObject the one ball of the game.
+ * @param brick GameObject the brick that is hit.
+ */
+ @Override
+ protected void actionIfBallHitsBrick(GameObject ball, GameObject brick) {
+ ball.setVY(ball.getVY() * -1);
+ this.deleteObject(brick.id);
+ }
+
+ /**
+ * This method defines the behavior when the ball hits the EgoObject.
+ *
+ * @param ball GameObject the one ball in the game.
+ * @param ego GameObject the object the player controls.
+ *
+ */
+ @Override
+ protected void actionIfBallHitsEgo(GameObject ball, GameObject ego) {
+ ball.setVY(ball.getVY() * -1);
+ }
+
+ /**
+ * This method creates a new RectObject.
+ *
+ * @return ego object.
+ */
+ @Override
+ protected GameObject createEgoObject() {
+
+ RectObject ego = new RectObject("ego", this, 350d, 550d, 0d, 0d, 80d, 10d, Color.BLUE);
+ EgoController eController = new EgoController(80d, 10d);
+ ego.addController(eController);
+ RectCollider collider1 = new RectCollider("collider1", ego, 80d, 10d);
+ ego.addCollider(collider1);
+ logger2.info("sucessfully created ego object with controller and collider");
+ return ego;
+ }
+
+ /**
+ * This method creates a new ball.
+ *
+ * @return ball
+ */
+ @Override
+ protected GameObject createBall() {
+ FallingStar ball = new FallingStar("ball", this, 350d, 350d, 120d, 120d, Color.RED, 5d);
+ ReboundController2 bbound = new ReboundController2();
+ ball.addController(bbound);
+ logger2.info("sucessfully created ball object with controller");
+ return ball;
+ }
+
+ /**
+ * This method creates a new brick.
+ *
+ * @param row int row for position of the brick.
+ * @param column int column for the position of the brick.
+ *
+ * @return brick.
+ */
+ @Override
+ protected GameObject createBrick(int row, int column) {
+ RectObject brick = new RectObject("brick" + row + column, this, 40d+ column * 65, 40d + row * 35, 0d, 0d, 60d, 30d, Color.GREEN);
+ RectCollider greenCollider = new RectCollider("greenCollider", brick, 60d, 30d);
+ brick.addCollider(greenCollider);
+ logger2.info("sucessfully created a brick object and collider");
+ return brick;
+ }
+
+ /**
+ * This method creates 3 rows and 10 columns with bricks. It also adds objects of ball and ego to Playground.
+ */
+ @Override
+ public void prepareLevel(String level) {
+ this.ego = createEgoObject();
+ this.ball = createBall();
+ this.addObject(this.ego);
+ this.addObject(this.ball);
+ logger2.info("added ego and ball object to the current level");
+
+ for (int i = 0; i < 3; i++) {
+ for (int j = 0; j < 10; j++) {
+ this.addObject(createBrick(i ,j));
+ }
+ }
+ logger2.info("created all 30 bricks");
+
+ }
+
+}