Jump to content

Mouse Trail


Swizzbeat

Recommended Posts

Was trying to figure this out and stumbled upon an old thread on another botting site with the code. All credit goes to a member over there by the name of Enfilade.

 

Needed variable in your main class (where you'll be doing the painting):

private final LinkedList<MousePathPoint> mousePath = new LinkedList<MousePathPoint>();

The MousePathPoint class (could also of course just be made into an inner class):

import java.awt.Point;

//ALL CREDITS TO ENFILADE

class MousePathPoint extends Point {

	private long finishTime;
	private double lastingTime;

	public MousePathPoint(int x, int y, int lastingTime) {
		super(x, y);
		this.lastingTime = lastingTime;
		finishTime = System.currentTimeMillis() + lastingTime;
	}

	public boolean isUp() {
		return System.currentTimeMillis() > finishTime;
	}
	
}

And the code that should go into your onPaint method:

while (!mousePath.isEmpty() && mousePath.peek().isUp())
	mousePath.remove();
Point clientCursor = client.getMousePosition();
MousePathPoint mpp = new MousePathPoint(clientCursor.x, clientCursor.y, 300); //1000 = lasting time/MS
if (mousePath.isEmpty() || !mousePath.getLast().equals(mpp))
	mousePath.add(mpp);
MousePathPoint lastPoint = null;
for (MousePathPoint a : mousePath) {
	if (lastPoint != null) {
		g.setColor(Color.YELLOW); //trail color
		g.drawLine(a.x, a.y, lastPoint.x, lastPoint.y);
	}
lastPoint = a;
}

f206f227f732fcdec98e33db76cc84f1.gif

Edited by Swizzbeat
  • Like 1
Link to comment
Share on other sites

  • 2 months later...
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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