diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 6b08b4e..1ce6142 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,8 +5,10 @@ + + - + { "associatedIndex": 8 @@ -36,6 +39,7 @@ + + @@ -159,4 +171,14 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/GameLogic.java b/src/main/java/GameLogic.java index a35eb5f..de978d3 100644 --- a/src/main/java/GameLogic.java +++ b/src/main/java/GameLogic.java @@ -10,31 +10,16 @@ public class GameLogic extends PApplet { PApplet.main("GameLogic"); } -/* public boolean checkForPlayerCollision(Point point){ - int c = get(point.x, point.y); - if (c==0){ - return true; //Kollision erkannt - } else { - return false; - } + public void settings() { + size(800, 600); + noLoop(); } - public void drawCheckTrail(Queue trail){ - int particleSize = trail.size()+5; - background(255); - - for (int[] koordinates : new LinkedList<>(trail)) { - int x = koordinates[0]; - int y = koordinates[1]; - fill(0,0,0); - rect(x, y, particleSize, particleSize); - } - } -*/ - public boolean doCheck(Queue trail, Point point){ + int particleSize = trail.size()+5; - background(255); + + background(255, 255, 255); for (int[] koordinates : new LinkedList<>(trail)) { int x = koordinates[0]; diff --git a/src/main/java/GameLoop.java b/src/main/java/GameLoop.java index 4e7ad0c..a99b4aa 100644 --- a/src/main/java/GameLoop.java +++ b/src/main/java/GameLoop.java @@ -16,13 +16,17 @@ public class GameLoop { Player player2; public GameLoop(){ - player1 = new Player(0, "ip", 9000); - player2 = new Player(1, "ip", 9000); + player1 = new Player(0, "192.168.1.1", 9000); + player2 = new Player(1, "192.168.1.2", 9000); tracker = new Tracker(); + graphics = new GraphicsProgram(); String[] args = {"GraphicsProgram"}; PApplet.runSketch(args, graphics); + gl = new GameLogic(); + String[] args_ = {"GameLogic"}; + PApplet.runSketch(args_, gl); run(); } @@ -32,8 +36,6 @@ public class GameLoop { List positions = track(); - addPositions(positions); - if(gl.doCheck(player2.getTrail(), positions.get(0))){ //Check Position von P1 mit Spur von P2 System.out.println("Spieler 1 hat verloren"); break; @@ -60,14 +62,13 @@ public class GameLoop { player2.setKoords(p2.x, p2.y); List output = new ArrayList<>(); - output.set(0, p1); - output.set(1, p2); + output.add(0, p1); + output.add(1, p2); return output; } private void draw(){ graphics.drawTrail(player1.getTrail(), 0); graphics.drawTrail(player2.getTrail(), 1); - } }