V2.2 des Gameloop und Logic
11.12.24 16:45
This commit is contained in:
parent
32bad236ed
commit
739a7e129c
24
.idea/workspace.xml
generated
24
.idea/workspace.xml
generated
@ -5,8 +5,10 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="4d75e996-cee4-4ec6-b802-5b56d0c0eac4" name="Changes" comment="Version 27.11 ("fertiger" Tracker)">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/GameLogic.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/GameLogic.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/GameLoop.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/GameLoop.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/Main.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/GraphicsProgram.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/GraphicsProgram.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/Tracker.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/Tracker.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
@ -23,6 +25,7 @@
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
<option name="UPDATE_TYPE" value="REBASE" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo">{
|
||||
"associatedIndex": 8
|
||||
@ -36,6 +39,7 @@
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"Application.GTCar.executor": "Run",
|
||||
"Application.GameLogic.executor": "Run",
|
||||
"Application.GraphicsProgram.executor": "Run",
|
||||
"Application.Main.executor": "Run",
|
||||
"Application.Tracker.executor": "Run",
|
||||
@ -69,6 +73,13 @@
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="GameLogic" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="GameLogic" />
|
||||
<module name="GTCar_V2_maven" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="Main" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="Main" />
|
||||
<module name="GTCar_V2_maven" />
|
||||
@ -79,6 +90,7 @@
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Application.Main" />
|
||||
<item itemvalue="Application.GameLogic" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
@ -159,4 +171,14 @@
|
||||
<MESSAGE value="Version 27.11 ("fertiger" Tracker)" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Version 27.11 ("fertiger" Tracker)" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<breakpoints>
|
||||
<breakpoint enabled="true" type="java-exception">
|
||||
<properties class="java.lang.NullPointerException" package="java.lang" />
|
||||
<option name="timeStamp" value="1" />
|
||||
</breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
</project>
|
@ -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<int[]> 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<int[]> trail, Point point){
|
||||
|
||||
int particleSize = trail.size()+5;
|
||||
background(255);
|
||||
|
||||
background(255, 255, 255);
|
||||
|
||||
for (int[] koordinates : new LinkedList<>(trail)) {
|
||||
int x = koordinates[0];
|
||||
|
@ -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<Point> 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<Point> 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);
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user