From 29a65e51ac3f4d6a48046b49994135f9b0cf6598 Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Mon, 23 Mar 2020 13:42:48 +0100 Subject: [PATCH] =?UTF-8?q?Gj=C3=B8r=20slik=20at=20et=20IDrawableGame=20re?= =?UTF-8?q?turnerer=20en=20liste=20med=20partikler?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fiasko/roborally/objects/IDrawableGame.java | 10 ++++++++++ .../fiasko/roborally/objects/RoboRallyGame.java | 12 ++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main/java/inf112/fiasko/roborally/objects/IDrawableGame.java b/src/main/java/inf112/fiasko/roborally/objects/IDrawableGame.java index 847f158..0c059b2 100644 --- a/src/main/java/inf112/fiasko/roborally/objects/IDrawableGame.java +++ b/src/main/java/inf112/fiasko/roborally/objects/IDrawableGame.java @@ -39,6 +39,16 @@ public interface IDrawableGame { */ List getWallsToDraw(); + /** + * Gets a list of all the particles to be drawn + * + * Should return a list readable from top-left to top-right and so on. In other words, the first getWidth() + * particles should be drawn on the top row from left to right. + * + * @return A list of particles + */ + List getParticlesToDraw(); + /** * Gets a list of all robots to draw * @return A list of all robots to draw diff --git a/src/main/java/inf112/fiasko/roborally/objects/RoboRallyGame.java b/src/main/java/inf112/fiasko/roborally/objects/RoboRallyGame.java index 0547f63..d7f16f3 100644 --- a/src/main/java/inf112/fiasko/roborally/objects/RoboRallyGame.java +++ b/src/main/java/inf112/fiasko/roborally/objects/RoboRallyGame.java @@ -50,6 +50,11 @@ public class RoboRallyGame implements IDrawableGame { return gameBoard.getWalls(); } + @Override + public List getParticlesToDraw() { + return gameBoard.getParticles(); + } + @Override public List getRobotsToDraw() { return gameBoard.getAliveRobots(); @@ -97,7 +102,7 @@ public class RoboRallyGame implements IDrawableGame { robots.add(new Robot(RobotID.ROBOT_6, new Position(7, 7))); robots.add(new Robot(RobotID.ROBOT_7, new Position(6, 7))); robots.add(new Robot(RobotID.ROBOT_8, new Position(6, 8))); - gameBoard = BoardLoaderUtil.loadBoard("boards/Checkmate.txt", robots); + gameBoard = BoardLoaderUtil.loadBoard("boards/Dizzy_Dash.txt", robots); cogwheels = gameBoard.getPositionsOfTileOnBoard(TileType.COGWHEEL_RIGHT, TileType.COGWHEEL_LEFT); fastConveyorBelts = gameBoard.getPositionsOfTileOnBoard(TileType.CONVEYOR_BELT_FAST, @@ -133,6 +138,7 @@ public class RoboRallyGame implements IDrawableGame { TimeUnit.SECONDS.sleep(3); makeMove(RobotID.ROBOT_1, Action.MOVE_1); makeMove(RobotID.ROBOT_1, Action.MOVE_2); + fireAllLasers(); makeMove(RobotID.ROBOT_1, Action.BACK_UP); makeMove(RobotID.ROBOT_1, Action.BACK_UP); makeMove(RobotID.ROBOT_1, Action.MOVE_3); @@ -157,7 +163,6 @@ public class RoboRallyGame implements IDrawableGame { checkAllFlags(); rotateCogwheels(); makeMove(RobotID.ROBOT_7, Action.MOVE_1); - fireAllLasers(); } /** @@ -365,6 +370,9 @@ public class RoboRallyGame implements IDrawableGame { } } + /** + * Fires all lasers on the game board + */ private void fireAllLasers() { gameBoard.fireAllLasers(); }