I've just started playing robocode and I've encountered this angle problem at my first robot project. I've wright following code in order to shot enemies nearby ;
public void onScannedRobot(ScannedRobotEvent e) {
double radarAngle ;
double GunZeroAngle ;
double difference ;
radarAngle = getRadarHeading ();
GunZeroAngle = getGunHeading () ;
difference = radarAngle - GunZeroAngle ;
System.out.print("Target :" + radarAngle + "\nZero : "+ GunZeroAngle +" \nFark : "+ Diff + " \n "+ " *********************** "+ "\n" );
if (fark != 0) {
turnGunRight (fark) ;
fire(1);
my problem is when enemies are too far away there are dead angles that my gun can't swipe like this;
and here is angles which I've written to robolog ;
I guess angle differences less then 1 degree are the problem. But sample robots like "corners" can focus on target at any angle. Can someone help me ???
You should get the heading of the scanned Robot from the
ScannedRobotEvent
Then turn your gun into that direction and fire.