Difference between revisions of "Module/Targeting/HeadOnTargeting"

From Robowiki
Jump to navigation Jump to search
(Module Targeting: HeadOnTargeting)
 
m (Using <syntaxhighlight>.)
 
Line 1: Line 1:
<pre>
+
<syntaxhighlight>
 
package jab.targeting;
 
package jab.targeting;
  
Line 16: Line 16:
 
}
 
}
 
}
 
}
</pre>
+
</syntaxhighlight>

Latest revision as of 10:29, 1 July 2010

package jab.targeting;

import jab.Module;
import jab.Targeting;

public class HeadOnTargeting extends Targeting {

	public HeadOnTargeting(Module bot) {
		super(bot);
	}

	public void target() {
		double absoluteBearing = bot.getHeadingRadians() + bot.enemy.bearingRadians;
		bot.setTurnGunRightRadians(robocode.util.Utils.normalRelativeAngle(absoluteBearing -bot.getGunHeadingRadians()));
	}
}