Jump to content

Minimap help


arvy2kas

Recommended Posts

Highlighting a tile ingame:

public void drawTileIngame(Script script, Graphics g, Position p, Color positionColor) {
  g.setColor(positionColor);
  Polygon PosHighlight = p.getPolygon(script.getBot());
  g.drawPolygon(PosHighlight);
 }

Marking tile on minimap: (this code is for marking an entity on the minimap)

public void drawMinimapPosition(Script script, Graphics g,
			Entity entity, Color positionColor, Color textColor, boolean fill) {
		if (entity != null && entity.exists()) {
			short[] minimapP = GraphicUtilities.getMinimapScreenCoordinate(
					script.getBot(), entity.getX(), entity.getY());
			if (minimapP[0] > 0) {
				g.setColor(positionColor);
				if (fill) 
					g.fillRect(minimapP[0] - 2, minimapP[1] - 2, 4, 4);
				 else 
					g.drawRect(minimapP[0] - 2, minimapP[1] - 2, 4, 4);
				
				g.setColor(textColor);
				g.drawString(entity.getName(), minimapP[0] - 4, minimapP[1] - 4);
			}
		}
	}

Marking a position: (modded of the above to remove the unneeded stuff)

public static void drawMinimapPosition(Script script, Graphics g,
			Position p, Color positionColor, Color textColor, boolean fill) {
		if (p != null) {
			short[] minimapP = GraphicUtilities.getMinimapScreenCoordinate(
					script.getBot(), entity.getX(), entity.getY());
			if (minimapP[0] > 0) {
				g.setColor(positionColor);
				if (fill) 
					g.fillRect(minimapP[0] - 2, minimapP[1] - 2, 4, 4);
				 else 
					g.drawRect(minimapP[0] - 2, minimapP[1] - 2, 4, 4);
				g.setColor(textColor);
			}
		}
	}
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...