mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 06:18:44 +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() {
|
||||
GameState.setCurrentStage(GameStages.RACING);
|
||||
setContentPane("/views/RaceView.fxml");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,13 +62,12 @@ public class StartScreenController {
|
||||
try {
|
||||
String ipAddress = InetAddress.getLocalHost().getHostAddress();
|
||||
new GameState(ipAddress);
|
||||
new MainServerThread()
|
||||
new MainServerThread();
|
||||
ClientToServerThread clientToServerThread = new ClientToServerThread("localhost", 4950);
|
||||
controller.setClientToServerThread(clientToServerThread);
|
||||
// new GameServerThread("Fuck you");
|
||||
// get the lobby controller so that we can pass the game server thread to it
|
||||
setContentPane("/views/LobbyView.fxml");
|
||||
|
||||
} catch (UnknownHostException e) {
|
||||
System.err.println("COULD NOT FIND YOUR IP ADDRESS!");
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -64,18 +64,16 @@ public class ServerToClientThread implements Runnable {
|
||||
sourceId = GameState.getUniquePlayerID();
|
||||
if (threeWayHandshake(sourceId)) {
|
||||
serverLog("Successful handshake. Client allocated id: " + sourceId, 1);
|
||||
GameState.addYacht(sourceId,
|
||||
new Yacht("Kappa", "Kap", new GeoPoint(0.0, 0.0), 0.0));
|
||||
GameState.addPlayer(new Player(socket)); //Is this neccesary???
|
||||
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));
|
||||
} else {
|
||||
serverLog("Unsuccessful handshake. Connection rejected", 1);
|
||||
closeSocket();
|
||||
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;
|
||||
thread = new Thread(this);
|
||||
thread.start();
|
||||
|
||||
@@ -93,7 +93,7 @@ public class Yacht {
|
||||
this.boatName = boatName;
|
||||
this.velocity = boatVelocity;
|
||||
this.shortName = shortName;
|
||||
this.sourceID = id;
|
||||
this.sourceId = id;
|
||||
this.sailIn = false;
|
||||
}
|
||||
|
||||
@@ -339,7 +339,4 @@ public class Yacht {
|
||||
return location;
|
||||
}
|
||||
|
||||
public Double getHeading() {
|
||||
return heading;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user