Esempio n. 1
0
 public void render(Obstacle obstacle) {
   Vector adjustedPosition = obstacle.position().add(viewPoint);
   graphics.drawOval(
       (int) (adjustedPosition.x() - obstacle.boundingRadius()),
       (int) (adjustedPosition.y() - obstacle.boundingRadius()),
       (int) (obstacle.boundingRadius() * 2),
       (int) (obstacle.boundingRadius() * 2));
 }
Esempio n. 2
0
 public void render(WatchTower watchTower) {
   Vector pos = watchTower.position().add(viewPoint);
   int x1 = (int) pos.x();
   int y1 = (int) pos.y();
   graphics.drawOval(x1 - 5, y1 - 5, 10, 10);
   /*
           Vector heading = watchTower.heading();
           int x2 = x1 + (int) (heading.x() * 20);
           int y2 = y1 + (int) (heading.y() * 20);
           graphics.drawLine(x1 + (int) (heading.x() * 5), y1 + (int) (heading.y() * 5), x2, y2);
   */
 }
Esempio n. 3
0
 public void render(TargetingSystem targetingSystem) {
   Vector pos = targetingSystem.position().add(viewPoint);
   int x = (int) pos.x();
   int y = (int) pos.y();
   int radius = (int) targetingSystem.boundingRadius();
   int diameter = radius * 2;
   graphics.drawOval(x - radius, y - radius, diameter, diameter);
   double hx = targetingSystem.heading().x();
   double hy = targetingSystem.heading().y();
   graphics.drawLine(
       x + (int) (hx * radius),
       y + (int) (hy * radius),
       x + (int) (hx * diameter),
       y + (int) (hy * diameter));
 }