java - What is the right way to move the mouse in a game? -
java - What is the right way to move the mouse in a game? -
i want programme bot minecraft automatically collects items. have problem move mouse in game. motion acts strange... jumping around @ x , y coordination if add together 1 y coordinate. movment acts in every 3d game not in minecraft.
for motion utilize integreated robot class.
here snipped utilize mouse movement:
public static void main(string[] args) { seek { robot bot = new robot(); point mouseposition = mouseinfo.getpointerinfo().getlocation(); int x = mouseposition.x; int y = mouseposition.y; //used switch game window bot.delay(5000); y += 1; bot.mousemove(x, y); } grab (awtexception e) { // todo auto-generated grab block e.printstacktrace(); } } what expecting code was, course of study move 1 pixel down. cursor moving fine if on desktop!
system:
os: windows 8.1 arch: amd64 javaversion: 1.7.0_67 ide: eclipse luna
you're capturing mouse location before switch game window, when add together 1 y coordinate, you're adding 1 mouse before moved switch game window. set delay before point mouseposition = mouseinfo.getpointerinfo().getlocation(); line instead.
java mouse
Comments
Post a Comment