Added leaderboard
This commit is contained in:
@@ -134,7 +134,6 @@ public class GameManager implements IGameManager {
|
||||
SocketUtils.sendObject(game.getSessions().get(id), "gamePlayerDead",
|
||||
new ObjectMapper().writeValueAsString(player));
|
||||
} catch (JsonProcessingException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -149,20 +148,12 @@ public class GameManager implements IGameManager {
|
||||
}
|
||||
|
||||
private boolean isCrossingLine (double xa, double ya, double xb, double yb, double xc, double yc, double radius) {
|
||||
/*
|
||||
var a = xc - xa;
|
||||
var b = xb - xa;
|
||||
var c = yc - ya;
|
||||
var d = yb - ya;
|
||||
var result = (a * d - b * c) / Math.sqrt(Math.pow(xa - xb, 2) + Math.pow(ya - yb, 2));
|
||||
*/
|
||||
|
||||
var result = Math.abs((yb - ya) * xc - (xb - xa) * yc + xb * ya - yb * xa)/ Math.sqrt(Math.pow(xb - xa, 2) + Math.pow(yb - ya, 2));
|
||||
var result = Math.abs((yb - ya) * xc - (xb - xa) * yc + xb * ya - yb * xa) / Math.sqrt(Math.pow(xb - xa, 2) + Math.pow(yb - ya, 2));
|
||||
|
||||
return result < radius;
|
||||
}
|
||||
|
||||
private Player initPlayer(Player player) {
|
||||
private Player initPlayer (Player player) {
|
||||
Random rand = new Random();
|
||||
double x = game.getSettings().getArenaSize() * (0.25 + Math.random() * 0.5);
|
||||
double y = game.getSettings().getArenaSize() * (0.25 + Math.random() * 0.5);
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
package gltronic.tronio.model;
|
||||
|
||||
public abstract class GameEntity {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user