Added leaderboard

This commit is contained in:
Thomas
2020-08-31 16:38:39 +02:00
parent 14be55df67
commit 85a8139270
5 changed files with 23 additions and 20 deletions

View File

@@ -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);

View File

@@ -1,5 +0,0 @@
package gltronic.tronio.model;
public abstract class GameEntity {
}