From 7c904a3634f58790770094f16c987017ab046fec Mon Sep 17 00:00:00 2001 From: Nour Date: Thu, 19 May 2022 14:21:15 +0200 Subject: [PATCH] =?UTF-8?q?=C2=B4hallo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GameProject/src/base/MultiLevelGame.java | 37 ++++++++++++++++ GameProject/src/playground/Level5.java | 39 +++++++++++++++++ GameProject/src/playground/Level6.java | 36 ++++++++++++++++ GameProject/src/playground/Level7.java | 35 ++++++++++++++++ GameProject/src/playground/LevelWithBox.java | 44 ++++++++++++++++++++ GameProject/src/playground/SU.java | 12 ++++++ 6 files changed, 203 insertions(+) create mode 100644 GameProject/src/base/MultiLevelGame.java create mode 100644 GameProject/src/playground/Level5.java create mode 100644 GameProject/src/playground/Level6.java create mode 100644 GameProject/src/playground/Level7.java create mode 100644 GameProject/src/playground/LevelWithBox.java create mode 100644 GameProject/src/playground/SU.java diff --git a/GameProject/src/base/MultiLevelGame.java b/GameProject/src/base/MultiLevelGame.java new file mode 100644 index 0000000..25a9cd4 --- /dev/null +++ b/GameProject/src/base/MultiLevelGame.java @@ -0,0 +1,37 @@ + 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.LevelWithBox; + +public class MultiLevelGame extends GameLoop { + + + @Override + + void defineLevels() { + this.addLevel(new LevelWithBox()); + this.addLevel(new Level5()); + this.addLevel(new Level6()); + this.addLevel(new Level7()); + + } + + + + + + public static void main(String[] args) throws IOException { + MultiLevelGame prog2 = new MultiLevelGame(); + prog2.runGame(args); + + } + +} diff --git a/GameProject/src/playground/Level5.java b/GameProject/src/playground/Level5.java new file mode 100644 index 0000000..399de65 --- /dev/null +++ b/GameProject/src/playground/Level5.java @@ -0,0 +1,39 @@ +package playground; + +import java.awt.Color; + +import gameobjects.GameObject; + +public class Level5 extends SU{ + + + @Override + + protected int calcNrEnemies() { + return 5; + } + + @Override + + protected double calcEnemySpeedX() { + return 160; + } + + @Override + + protected double calcEnemySpeedY() { + return 80; + } + + @Override + + protected String getStartupMessage() { + return "Level5, get ready!"; + } + + + +} + + + diff --git a/GameProject/src/playground/Level6.java b/GameProject/src/playground/Level6.java new file mode 100644 index 0000000..2f2b549 --- /dev/null +++ b/GameProject/src/playground/Level6.java @@ -0,0 +1,36 @@ +package playground; + +import java.awt.Color; + +import gameobjects.GameObject; + +public class Level6 extends SU{ + + + + @Override + + protected int calcNrEnemies() { + return 12; + } + + @Override + + protected double calcEnemySpeedX() { + return 480; + } + + @Override + + protected double calcEnemySpeedY() { + return 80; + } + + @Override + + protected String getStartupMessage() { + return "Level6, get ready!"; + } + + +} diff --git a/GameProject/src/playground/Level7.java b/GameProject/src/playground/Level7.java new file mode 100644 index 0000000..0edf61a --- /dev/null +++ b/GameProject/src/playground/Level7.java @@ -0,0 +1,35 @@ +package playground; + +import java.awt.Color; + +import gameobjects.GameObject; + +public class Level7 extends SU{ + + + + @Override + + protected int calcNrEnemies() { + return 21; + } + + @Override + + protected double calcEnemySpeedX() { + return 800; + } + + @Override + + protected double calcEnemySpeedY() { + return 140; + } + + @Override + + protected String getStartupMessage() { + return "Level7, get ready!"; + } + +} diff --git a/GameProject/src/playground/LevelWithBox.java b/GameProject/src/playground/LevelWithBox.java new file mode 100644 index 0000000..eef13fa --- /dev/null +++ b/GameProject/src/playground/LevelWithBox.java @@ -0,0 +1,44 @@ +package playground; + +import gameobjects.GameObject; + +import gameobjects.RectObject; + +import java.awt.Color; + +/** + * Represents the LevelWithBox. + * @author Nour Den Almasri + * + */ + +public class LevelWithBox extends SpaceInvadersLevel { + + /** + * Method prepares the new level. + * @param id String represents the level + * + */ + + @Override + + public void prepareLevel(String id) { + super.prepareLevel(id); + GameObject o = new RectObject("red", this, 350, 100, 0, 0, 700, 250, Color.RED); + this.addObject(o); + + } + + /** + * Method show the Start's message. + * @return the message should be showed + */ + + @Override + + protected String getStartupMessage() { + return "Get ready for box-Level!"; + } + + +} diff --git a/GameProject/src/playground/SU.java b/GameProject/src/playground/SU.java new file mode 100644 index 0000000..e795d3d --- /dev/null +++ b/GameProject/src/playground/SU.java @@ -0,0 +1,12 @@ +package playground; + +import gameobjects.GameObject; + +public class SU extends SpaceInvadersLevel{ + + + void actionIfEnemyIsHit(GameObject e, GameObject shot) { + super.actionIfEnemyIsHit(e, shot); + System.out.println("AUA!!"); + } +}