okay here's my code ;D
The goto function:
Code:
public void goTo(double x2,double y2)
{
if (calcangleL(x2,y2) < calcangleR(x2,y2))
{
while(calcangleL(x2,y2)<calcangleR(x2,y2))
{
robot2.keyPress(KeyEvent.VK_A);
robot2.delay(25);
robot2.keyRelease(KeyEvent.VK_A);
}
}
if (calcangleL(x2,y2) > calcangleR(x2,y2))
{
while(calcangleL(x2,y2)>calcangleR(x2,y2))
{
robot2.keyPress(KeyEvent.VK_D);
robot2.delay(25);
robot2.keyRelease(KeyEvent.VK_D);
}
}
}
The calcangleL function:
Code:
public static float calcangleL(double x2,double y2) throws NativeException, IllegalAccessException
{
float x=Get_FLOAT.getData(pBasePointer + 0x798);
float y=Get_FLOAT.getData(pBasePointer + 0x79C);
float l;
float f = (float)Math.atan2(y2 - y, x2 - x);
if(f<0)
{
f=(float) (f+Math.PI * 2);
}
if (Get_FLOAT.getData(pBasePointer + 0x7E0) > f)
{
l = (float) (((2 * Math.PI) - G Get_FLOAT.getDatapBasePointer + 0x7E0)) + f);
}
else
{
l = f - Get_FLOAT.getData(pBasePointer + 0x7E0);
}
return l;
}
The calcangleR function:
Code:
public static float calcangleR(double x2,double y2)
{
float x=Get_FLOAT.getData(pBasePointer + 0x798);
float y=Get_FLOAT.getData(pBasePointer + 0x79C);
float f = (float)Math.atan2(y2 - y, x2 - x);
if(f<0)
{
f=(float) (f+Math.PI * 2);
}
float r;
if (Get_FLOAT.getData(pBasePointer + 0x7E0) > f)
{
r = Get_FLOAT.getData(pBasePointer + 0x7E0) - f;
}
else
{
r = (float) (Get_FLOAT.getData(pBasePointer + 0x7E0) + ((2 * Math.PI) - f));
}
return r;
}
hoping that helps ;D