Version 20.11
This commit is contained in:
parent
93e39b11e3
commit
c6f1afc206
41
.idea/workspace.xml
generated
41
.idea/workspace.xml
generated
@ -4,14 +4,7 @@
|
|||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="4d75e996-cee4-4ec6-b802-5b56d0c0eac4" name="Changes" comment="Grundstrukur">
|
<list default="true" id="4d75e996-cee4-4ec6-b802-5b56d0c0eac4" name="Changes" comment="First Commit Test" />
|
||||||
<change afterPath="$PROJECT_DIR$/src/main/java/GameLoop.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.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/Player.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/Player.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" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
@ -38,10 +31,6 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent"><![CDATA[{
|
<component name="PropertiesComponent"><![CDATA[{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
"Downloaded.Files.Path.Enabled": "false",
|
|
||||||
"Repository.Attach.Annotations": "false",
|
|
||||||
"Repository.Attach.JavaDocs": "false",
|
|
||||||
"Repository.Attach.Sources": "false",
|
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"com.codeium.enabled": "true",
|
"com.codeium.enabled": "true",
|
||||||
"git-widget-placeholder": "master",
|
"git-widget-placeholder": "master",
|
||||||
@ -51,9 +40,9 @@
|
|||||||
"node.js.selected.package.eslint": "(autodetect)",
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
"node.js.selected.package.tslint": "(autodetect)",
|
"node.js.selected.package.tslint": "(autodetect)",
|
||||||
"nodejs_package_manager_path": "npm",
|
"nodejs_package_manager_path": "npm",
|
||||||
"project.structure.last.edited": "Libraries",
|
"project.structure.last.edited": "Project",
|
||||||
"project.structure.proportion": "0.15",
|
"project.structure.proportion": "0.15",
|
||||||
"project.structure.side.proportion": "0.41724136",
|
"project.structure.side.proportion": "0.0",
|
||||||
"vue.rearranger.settings.migration": "true"
|
"vue.rearranger.settings.migration": "true"
|
||||||
}
|
}
|
||||||
}]]></component>
|
}]]></component>
|
||||||
@ -73,7 +62,7 @@
|
|||||||
<option name="number" value="Default" />
|
<option name="number" value="Default" />
|
||||||
<option name="presentableId" value="Default" />
|
<option name="presentableId" value="Default" />
|
||||||
<updated>1732108904989</updated>
|
<updated>1732108904989</updated>
|
||||||
<workItem from="1732108906083" duration="3420000" />
|
<workItem from="1732108906083" duration="758000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="First Commit Test">
|
<task id="LOCAL-00001" summary="First Commit Test">
|
||||||
<option name="closed" value="true" />
|
<option name="closed" value="true" />
|
||||||
@ -83,23 +72,7 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1732109548353</updated>
|
<updated>1732109548353</updated>
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00002" summary="Second Commit Test">
|
<option name="localTasksCounter" value="2" />
|
||||||
<option name="closed" value="true" />
|
|
||||||
<created>1732109721570</created>
|
|
||||||
<option name="number" value="00002" />
|
|
||||||
<option name="presentableId" value="LOCAL-00002" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1732109721570</updated>
|
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00003" summary="Grundstrukur">
|
|
||||||
<option name="closed" value="true" />
|
|
||||||
<created>1732109899753</created>
|
|
||||||
<option name="number" value="00003" />
|
|
||||||
<option name="presentableId" value="LOCAL-00003" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1732109899753</updated>
|
|
||||||
</task>
|
|
||||||
<option name="localTasksCounter" value="4" />
|
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
@ -118,8 +91,6 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value="First Commit Test" />
|
<MESSAGE value="First Commit Test" />
|
||||||
<MESSAGE value="Second Commit Test" />
|
<option name="LAST_COMMIT_MESSAGE" value="First Commit Test" />
|
||||||
<MESSAGE value="Grundstrukur" />
|
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="Grundstrukur" />
|
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -1,2 +1,35 @@
|
|||||||
|
import com.illposed.osc.OSCMessage;
|
||||||
|
import com.illposed.osc.transport.OSCPortOut;
|
||||||
|
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class ArduinoCommunicator {
|
public class ArduinoCommunicator {
|
||||||
|
private InetAddress address;
|
||||||
|
private int port;
|
||||||
|
private OSCPortOut oscPortOut;
|
||||||
|
|
||||||
|
public ArduinoCommunicator(String ipAdress, int portNr) {
|
||||||
|
try{
|
||||||
|
address = InetAddress.getByName(ipAdress);
|
||||||
|
port = portNr;
|
||||||
|
oscPortOut = new OSCPortOut(address, port);
|
||||||
|
}
|
||||||
|
catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendMessage(double speed, double steer, boolean light){
|
||||||
|
String oscAddress = "/arduino/command"; // OSC-Adresse für die Nachricht
|
||||||
|
OSCMessage message = new OSCMessage(oscAddress, Arrays.asList(speed, steer, light));
|
||||||
|
|
||||||
|
try {
|
||||||
|
oscPortOut.send(message);
|
||||||
|
}
|
||||||
|
catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
System.out.println("OSC Nachricht gesendet: " + message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,40 +0,0 @@
|
|||||||
pu
|
|
||||||
Player
|
|
||||||
objekte
|
|
||||||
private Player player1 = new Player(0, 0);
|
|
||||||
private Player player2 = new Player(0, 0);
|
|
||||||
|
|
||||||
setUp()
|
|
||||||
|
|
||||||
// Playerobjekte
|
|
||||||
private Player player1 = new Player(0, 0);
|
|
||||||
private Player player2 = new Player(0, 0);
|
|
||||||
|
|
||||||
|
|
||||||
d set
|
|
||||||
{}()pU
|
|
||||||
iov etavirpleLogic gl = newmaG tatic void main(String[
|
|
||||||
{}sgra ])ic class GameLogic g
|
|
||||||
publ.run;
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
private void run(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void trackPlayer1(){
|
|
||||||
|
|
||||||
}
|
|
||||||
private void drawGrafics(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void trackPlayer2(){
|
|
||||||
|
|
||||||
}
|
|
||||||
private void checkPlayerCollission(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -3,34 +3,53 @@ import java.util.Queue;
|
|||||||
|
|
||||||
public class Player {
|
public class Player {
|
||||||
// Attribute für die x- und y-Koordinaten
|
// Attribute für die x- und y-Koordinaten
|
||||||
private int id;
|
private final int ID;
|
||||||
private int trailLength = 30;
|
private int x;
|
||||||
|
private int y;
|
||||||
Queue<int[]> trail = new LinkedList<>();
|
Queue<int[]> trail = new LinkedList<>();
|
||||||
|
|
||||||
// Konstruktor zur Initialisierung der Koordinaten
|
ArduinoCommunicator arduinoCommunicator;
|
||||||
public Player(int id) {
|
|
||||||
this.id = id;
|
|
||||||
|
|
||||||
|
private final int TRAIL_LENGTH = 30;
|
||||||
|
|
||||||
|
// Konstruktor
|
||||||
|
public Player(int id, String finalIpAddress, int finalPortNr) {
|
||||||
|
this.ID = id;
|
||||||
|
arduinoCommunicator = new ArduinoCommunicator(finalIpAddress, finalPortNr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//fügt 2 Koordinaten zum Trail hinzu und verhindert, dass dieser zulang wird
|
//fügt 2 Koordinaten zum Trail hinzu nd verhindert, dass dieser zulang wird
|
||||||
public void addToTrail(int x, int y){
|
public void setKoords(int x, int y){
|
||||||
|
addToTrail(x,y);
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addToTrail(int x, int y) {
|
||||||
this.trail.add(new int[]{x, y});
|
this.trail.add(new int[]{x, y});
|
||||||
|
|
||||||
if(trail.size() > trailLength){
|
if(trail.size() > TRAIL_LENGTH){
|
||||||
trail.poll();
|
trail.poll();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Queue<int[]> getTrail(){
|
public Queue<int[]> getTrail(){
|
||||||
return trail;
|
return trail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void sendToCar(double speed, double steer, boolean light){
|
||||||
|
arduinoCommunicator.sendMessage(speed, steer, light);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//gibt aktuelle Position aus
|
//gibt aktuelle Position aus
|
||||||
public void printPosition() {
|
public void printPosition() {
|
||||||
System.out.println("Player Position: (" + x + ", " + y + ")");
|
System.out.println(trail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user