From 5c31a47553a510a2f87d7258151f84c3f082945d Mon Sep 17 00:00:00 2001 From: MrDev023 Date: Sat, 21 Jan 2017 04:36:48 +0100 Subject: [PATCH] Bug fixes --- .../interfaces/MainInterfaces.java | 2 +- src/globalgamejam/world/MainWorld.java | 53 ++++++++++++++----- 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/src/globalgamejam/interfaces/MainInterfaces.java b/src/globalgamejam/interfaces/MainInterfaces.java index cf86231..c07cdeb 100644 --- a/src/globalgamejam/interfaces/MainInterfaces.java +++ b/src/globalgamejam/interfaces/MainInterfaces.java @@ -28,7 +28,7 @@ public class MainInterfaces { } public void init(){ - p1 = new GUILabel("Player 1 : ", Main.WIDTH/4 - 50,10, Color.WHITE,"Arial",16); + p1 = new GUILabel("Player 1 : ", Main.WIDTH/4 - 50,10, Color.RED,"Arial",16); p2 = new GUILabel("Player 2 : ", Main.WIDTH/4 * 3 - 50,10, Color.WHITE,"Arial",16); guis.add(p1); guis.add(p2); diff --git a/src/globalgamejam/world/MainWorld.java b/src/globalgamejam/world/MainWorld.java index 921a2b1..8d0b5bc 100644 --- a/src/globalgamejam/world/MainWorld.java +++ b/src/globalgamejam/world/MainWorld.java @@ -27,7 +27,7 @@ public class MainWorld { private MainGame game; - private Player player1; + private Player player1,player2; public MainWorld(MainGame game){ this.game = game; @@ -37,24 +37,22 @@ public class MainWorld { public void init(){ player1 = new Player(200, 150); - tiles.add(player1.getTile()); - tiles = new ArrayList(); + player2 = new Player(400, 150); + + Fond fond = new Fond("res/textures/fond.png"); fond.getTransform().translate(Main.WIDTH/2, Main.HEIGHT/2, 0); fond.getTransform().scale(Main.WIDTH,Main.HEIGHT, 0); - + tiles.add(fond); - TestTile test = new TestTile(); - test.getTransform().translate(0, 80, 0); - test.getTransform().scale(10, 10, 0); - tiles.add(test); - player1 = new Player(100, 0); tiles.add(player1.getTile()); + tiles.add(player2.getTile()); generateEntity(3); } public void update(){ + //Player 1 float xDep = 0, yDep = 0; if(Input.isKey(GLFW.GLFW_KEY_W)){ yDep = 10; @@ -76,14 +74,43 @@ public class MainWorld { player1.move(xDep, yDep); - if(Input.isKey(GLFW.GLFW_KEY_SPACE)){ + if(Input.isKey(GLFW.GLFW_KEY_Q)){ player1.rotate(-5); } - if(Input.isKey(GLFW.GLFW_KEY_LEFT_ALT)){ + if(Input.isKey(GLFW.GLFW_KEY_E)){ player1.rotate(5); } - - System.out.println(player1); + + //Player 2 + xDep = 0; + yDep = 0; + if(Input.isKey(GLFW.GLFW_KEY_I)){ + yDep = 10; + } + if(Input.isKey(GLFW.GLFW_KEY_K)){ + yDep = -10; + } + if(Input.isKey(GLFW.GLFW_KEY_J)){ + xDep = -10; + } + if(Input.isKey(GLFW.GLFW_KEY_L)){ + xDep = 10; + } + + if(xDep != 0.0 && yDep != 0.0){ + xDep *= Math.cos(Math.PI / 4); + yDep *= Math.cos(Math.PI / 4); + } + + player2.move(xDep, yDep); + + if(Input.isKey(GLFW.GLFW_KEY_U)){ + player2.rotate(-5); + } + if(Input.isKey(GLFW.GLFW_KEY_O)){ + player2.rotate(5); + } + } public void render(){