From b07f813a1508a558e0549d79e46de3ef84c1db75 Mon Sep 17 00:00:00 2001 From: jkonert Date: Thu, 12 May 2022 13:40:04 +0200 Subject: [PATCH] HA05 base files added --- GameProject/src/base/MovingObjectsGame.java | 33 +++++++++++++++++++ .../src/playground/LevelMovingObjects.java | 21 ++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 GameProject/src/base/MovingObjectsGame.java create mode 100644 GameProject/src/playground/LevelMovingObjects.java diff --git a/GameProject/src/base/MovingObjectsGame.java b/GameProject/src/base/MovingObjectsGame.java new file mode 100644 index 0000000..ab52fec --- /dev/null +++ b/GameProject/src/base/MovingObjectsGame.java @@ -0,0 +1,33 @@ +package base; + +import java.io.IOException; +import playground.LevelMovingObjects; + +/** + * main class to start a game with only one level {@link playground.LevelMovingObjects}. + * + */ +public class MovingObjectsGame extends GameLoop { + + /** + * starts this game. + * + * @param args command line parameters (forwarded to {@link GameLoop#runGame(String[])}). + * @throws IOException if highscore.txt file cannot be written or accessed, the exception is + * thrown (and game ends). + */ + public static void main(String[] args) throws IOException { + GameLoop myGame = new MovingObjectsGame(); + myGame.runGame(args); + } + + /** + * adds only one level to play ({@link playground.LevelMovingObjects}). + */ + @Override + public void defineLevels() { + this.resetLevels(); + this.addLevel(new LevelMovingObjects()); + } + +} diff --git a/GameProject/src/playground/LevelMovingObjects.java b/GameProject/src/playground/LevelMovingObjects.java new file mode 100644 index 0000000..dd93acf --- /dev/null +++ b/GameProject/src/playground/LevelMovingObjects.java @@ -0,0 +1,21 @@ +package playground; + + + +/** 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 + + + /** "Moving Objects Level!" is the message. + * + * @return String "Moving Objects Level!" + */ + @Override + protected String getStartupMessage() { + return "Moving Objects Level!"; + } +} +