1
0
Fork 0

Bug fixes

This commit is contained in:
MrDev023 2017-01-21 04:36:48 +01:00
parent 0a34862090
commit 5c31a47553
2 changed files with 41 additions and 14 deletions

View file

@ -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);

View file

@ -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<Tile>();
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(){