mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Tried to merge game loop with the broadcast. Minor error in canvas. need to fix.
#story[1047]
This commit is contained in:
@@ -104,6 +104,5 @@ public class LobbyController implements Initializable{
|
|||||||
public void readyButtonPressed() {
|
public void readyButtonPressed() {
|
||||||
GameState.setCurrentStage(GameStages.RACING);
|
GameState.setCurrentStage(GameStages.RACING);
|
||||||
setContentPane("/views/RaceView.fxml");
|
setContentPane("/views/RaceView.fxml");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,13 +62,12 @@ public class StartScreenController {
|
|||||||
try {
|
try {
|
||||||
String ipAddress = InetAddress.getLocalHost().getHostAddress();
|
String ipAddress = InetAddress.getLocalHost().getHostAddress();
|
||||||
new GameState(ipAddress);
|
new GameState(ipAddress);
|
||||||
new MainServerThread()
|
new MainServerThread();
|
||||||
ClientToServerThread clientToServerThread = new ClientToServerThread("localhost", 4950);
|
ClientToServerThread clientToServerThread = new ClientToServerThread("localhost", 4950);
|
||||||
controller.setClientToServerThread(clientToServerThread);
|
controller.setClientToServerThread(clientToServerThread);
|
||||||
// new GameServerThread("Fuck you");
|
// new GameServerThread("Fuck you");
|
||||||
// get the lobby controller so that we can pass the game server thread to it
|
// get the lobby controller so that we can pass the game server thread to it
|
||||||
setContentPane("/views/LobbyView.fxml");
|
setContentPane("/views/LobbyView.fxml");
|
||||||
|
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
System.err.println("COULD NOT FIND YOUR IP ADDRESS!");
|
System.err.println("COULD NOT FIND YOUR IP ADDRESS!");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@@ -64,18 +64,16 @@ public class ServerToClientThread implements Runnable {
|
|||||||
sourceId = GameState.getUniquePlayerID();
|
sourceId = GameState.getUniquePlayerID();
|
||||||
if (threeWayHandshake(sourceId)) {
|
if (threeWayHandshake(sourceId)) {
|
||||||
serverLog("Successful handshake. Client allocated id: " + sourceId, 1);
|
serverLog("Successful handshake. Client allocated id: " + sourceId, 1);
|
||||||
GameState.addYacht(sourceId,
|
Yacht yacht = new Yacht("Yacht", sourceId, sourceId.toString(), "Kap", "Kappa", "NZ");
|
||||||
new Yacht("Kappa", "Kap", new GeoPoint(0.0, 0.0), 0.0));
|
// Yacht yacht = new Yacht("Kappa", "Kap", new GeoPoint(57.6708220, 11.8321340), 90.0);
|
||||||
GameState.addPlayer(new Player(socket)); //Is this neccesary???
|
GameState.addYacht(sourceId, yacht);
|
||||||
|
GameState.addPlayer(new Player(socket, yacht));
|
||||||
} else {
|
} else {
|
||||||
serverLog("Unsuccessful handshake. Connection rejected", 1);
|
serverLog("Unsuccessful handshake. Connection rejected", 1);
|
||||||
closeSocket();
|
closeSocket();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Yacht yacht = new Yacht("Yacht", sourceId, sourceId.toString(), "Kap", "Kappa", "NZ");
|
|
||||||
// Yacht yacht = new Yacht("Kappa", "Kap", new GeoPoint(57.6708220, 11.8321340), 90.0);
|
|
||||||
GameState.addYacht(sourceId, yacht);
|
|
||||||
GameState.addPlayer(new Player(socket, yacht));
|
|
||||||
seqNo = 0;
|
seqNo = 0;
|
||||||
thread = new Thread(this);
|
thread = new Thread(this);
|
||||||
thread.start();
|
thread.start();
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ public class Yacht {
|
|||||||
this.boatName = boatName;
|
this.boatName = boatName;
|
||||||
this.velocity = boatVelocity;
|
this.velocity = boatVelocity;
|
||||||
this.shortName = shortName;
|
this.shortName = shortName;
|
||||||
this.sourceID = id;
|
this.sourceId = id;
|
||||||
this.sailIn = false;
|
this.sailIn = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,7 +339,4 @@ public class Yacht {
|
|||||||
return location;
|
return location;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Double getHeading() {
|
|
||||||
return heading;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user