Ejemplo n.º 1
0
 public void showLine(WorldEntity e, Color c) {
   Graphics g = getGObject().getEditor().getGraphics();
   Point cme = getGObject().getCenter();
   Point ce = e.getGObject().getCenter();
   g.setColor(c);
   g.drawLine(cme.x, cme.y, ce.x, ce.y);
 }
Ejemplo n.º 2
0
 /** Computes and returns the distance between two entities */
 public int getDistance(WorldEntity e) {
   Point wp = e.getPosition();
   Point mep = getPosition();
   int dx = wp.x - mep.x;
   int dy = wp.y - mep.y;
   return ((int) Math.round(Math.sqrt(dx * dx + dy * dy)));
 }