Jump to content

How to draw my path?


futurepasts

Recommended Posts

Hello so i wanted to draw my path for debugging resons  cuz it sometimes doesn't work properly but don't know where to start i know how to draw my current location but how to draw my path?

 

Thanks for help that i will hopefully get smile.png

 

You can use "Explv's Location Assistant" in the Other section, and just copy-paste your path, it will show on screen.

Link to comment
Share on other sites

Do you mean a predefined path? Or colour all the tiles that your player walks to?

 

Colouring every tile that your player walks to:

private final List<Position> WALKED_POSITIONS = new ArrayList<>();

@Override
public void onPaint(Graphics2D g){

   updateWalkedPositions();
   drawWalkedPositions(g); 
}

private void updateWalkedPositions(){

    if(!WALKED_POSITIONS.contains(myPosition())) WALKED_POSITIONS.add(myPosition());
}

private void drawWalkedPositions(Graphics2D g){

    for(Position position : WALKED_POSITIONS) fillPositionOnScreen(position, g); 
}

private void fillPositionOnScreen(Position position, Graphics2D g){

    Polygon polygon = position.getPolygon(script.getBot());
    g.fillPolygon(polygon.xpoints, polygon.ypoints, polygon.npoints);
}
Edited by Explv
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...