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); }
/** 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))); }