Polish Civil 90 Posted April 15, 2015 class class CircleArea implements Locatable { private final Tile center; private final int radius; /** * @param center * @param radius */ public CircleArea(Tile center, int radius) { this.center = center; this.radius = radius; } /** * @return */ public Tile getCenter() { return center; } /** * @param location * @return */ public boolean contains(Locatable location) { return location.tile().distanceTo(center) <= radius; } /** * @param g * @param ctx */ public void draw(Graphics2D g, ClientContext ctx) { drawMiniMap(g, ctx); } /** * @param g * @param ctx */ private void drawMiniMap(Graphics2D g, ClientContext ctx) { if (center.matrix(ctx).onMap()) { final Point point = center.matrix(ctx).mapPoint(); final int pixelRadius = radius * 8; g.setColor(contains(ctx.players.local().tile()) ? new Color(8, 174, 14, 128) : new Color(255, 0, 0, 128)); g.fillOval(point.x - pixelRadius / 2, point.y - pixelRadius / 2, pixelRadius, pixelRadius); g.setColor(Color.BLACK); g.drawOval(point.x - pixelRadius / 2, point.y - pixelRadius / 2, pixelRadius, pixelRadius); } } /** * @return */ public Tile random() { final double rX = Math.random(); final double rY = Math.random(); final double angle = 2 * Math.PI * rX / rY; final Point2D.Double point = new Point.Double( rY * (radius - 1) * Math.cos(angle), rY * (radius - 1) * Math.sin(angle) ); return new Tile((int) (center.x() + point.x), (int) (center.y() + point.y), tile().floor()); } @Override public Tile tile() { return center; } } You're welcome, you can donate me on paypal [email protected] for this amazing work.
Polish Civil 90 Author Posted April 15, 2015 Donate him, Money goes to the cinema. How you know it lol OH THATS YOU NOOB! ^ I HATE DIS GUY
Recommended Posts
Archived
This topic is now archived and is closed to further replies.