コード例 #1
0
ファイル: Tank.java プロジェクト: poffdeluxe/BattleTanks
 public double getDirection(Tank that) {
   Coordinate other = that.getLocation();
   return Math.atan2(other.y() - location.y(), other.x() - location.x());
 }
コード例 #2
0
ファイル: Coordinate.java プロジェクト: tageee/Draw
 public static void draw(Graphics g, Coordinate coo) {
   g.drawLine((int) coo.getX(), (int) coo.getY(), (int) coo.getX(), (int) coo.getY());
 }
コード例 #3
0
ファイル: Tank.java プロジェクト: poffdeluxe/BattleTanks
 public double getDistance(Tank that) {
   Coordinate other = that.getLocation();
   return Math.sqrt(Math.pow(other.x() - location.x(), 2) + Math.pow(other.x() - location.y(), 2));
 }