From 6c49fd0e9cff41ce9487a8c57cd3f017255b1eb4 Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Mon, 24 Feb 2020 23:35:58 +0100 Subject: [PATCH] Legger til tekstur for robot 2 Legger til flere steg i game loop demoen --- .../java/inf112/fiasko/roborally/game/Game.java | 9 +++++++++ .../roborally/utility/TextureConverterUtil.java | 7 +++++-- src/main/resources/assets/Robot2.png | Bin 0 -> 743 bytes 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/assets/Robot2.png diff --git a/src/main/java/inf112/fiasko/roborally/game/Game.java b/src/main/java/inf112/fiasko/roborally/game/Game.java index 36e5e5d..4460334 100644 --- a/src/main/java/inf112/fiasko/roborally/game/Game.java +++ b/src/main/java/inf112/fiasko/roborally/game/Game.java @@ -24,6 +24,7 @@ public class Game implements IDrawableGame { try { List robots = new ArrayList<>(); robots.add(new Robot(RobotID.ROBOT_1, new Position(1, 1))); + robots.add(new Robot(RobotID.ROBOT_2, new Position(1, 2))); gameBoard = BoardLoaderUtil.loadBoard("boards/Checkmate.txt", robots); new Thread(() -> { try { @@ -57,6 +58,14 @@ public class Game implements IDrawableGame { gameBoard.rotateRobotRight(RobotID.ROBOT_1); TimeUnit.SECONDS.sleep(1); gameBoard.moveRobot(RobotID.ROBOT_1, Direction.SOUTH); + TimeUnit.SECONDS.sleep(1); + gameBoard.moveRobot(RobotID.ROBOT_2, Direction.EAST); + TimeUnit.SECONDS.sleep(1); + gameBoard.moveRobot(RobotID.ROBOT_2, Direction.WEST); + TimeUnit.SECONDS.sleep(1); + gameBoard.moveRobot(RobotID.ROBOT_2, Direction.EAST); + TimeUnit.SECONDS.sleep(1); + gameBoard.moveRobot(RobotID.ROBOT_2, Direction.EAST); } @Override diff --git a/src/main/java/inf112/fiasko/roborally/utility/TextureConverterUtil.java b/src/main/java/inf112/fiasko/roborally/utility/TextureConverterUtil.java index fc87098..5755ac1 100644 --- a/src/main/java/inf112/fiasko/roborally/utility/TextureConverterUtil.java +++ b/src/main/java/inf112/fiasko/roborally/utility/TextureConverterUtil.java @@ -23,7 +23,8 @@ import java.util.Map; */ public final class TextureConverterUtil { private static final Texture textureSheet = new Texture(Gdx.files.internal("assets/tiles.png")); - private static final Texture robotTexture = new Texture(Gdx.files.internal("assets/Robot.png")); + private static final Texture robot1Texture = new Texture(Gdx.files.internal("assets/Robot.png")); + private static final Texture robot2Texture = new Texture(Gdx.files.internal("assets/Robot2.png")); private static Map tileSheetTileTextureMappings; private static Map tileSheetTileHasRotatedTextureMappings; private static Map tileSheetWallTextureMappings; @@ -83,7 +84,9 @@ public final class TextureConverterUtil { public static TextureRegion convertElement(Robot robot) { if (robot.getRobotId() == RobotID.ROBOT_1) { - return new TextureRegion(robotTexture, 0, 0, 64, 64); + return new TextureRegion(robot1Texture, 0, 0, 64, 64); + } else if (robot.getRobotId() == RobotID.ROBOT_2) { + return new TextureRegion(robot2Texture, 0, 0, 64, 64); } throw new IllegalArgumentException("Robot has no drawable texture."); } diff --git a/src/main/resources/assets/Robot2.png b/src/main/resources/assets/Robot2.png new file mode 100644 index 0000000000000000000000000000000000000000..3540ab74fa8f18efd2f0e6b02cf6013f5e3a1523 GIT binary patch literal 743 zcmV?P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!TI)6c{>* z0SpCyi)YC5Qa$$vV`jiP92vey8~Jj$B^q;4B41jb<<2BLmnJ~{wypXJj&Xzlhvd*X z-xT$Ayf6ENY?c@a@VTw}$s&M{*4~invb6W*r;pGW?Hs^fE$Rgb?g7i?66;y$wdwrz z9`M`dTve6#Z}-iBZ1FcE=p*{t?z@+LGoby;ChoEiAz{!x9}K1Mdxg&XX$E-1S&RV9 z5?~)f;*mKtaEz%15L(dy?A^s<+s9y0Ab<(LUM(g7d$pJV?A2lduvd!-z+NpT0DHAenGPej z@1(V{?T0XRHi*GsATX5Ox=U>Pq~s6)|B}Mx1`K7l?h@NRDYgl+S4(gc)POAk_DWeS Zz5zQkOhST5A<6&%002ovPDHLkV1m1LLM8wJ literal 0 HcmV?d00001