AngleAssistedBullet

From Robowiki
Revision as of 05:44, 31 December 2017 by Xor (talk | contribs) (add code example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
This article is a stub. You can help RoboWiki by expanding it.

AngleAssistedBullet is a bullet created by fire() or setFire() when your robot is not an AdvancedRobot, and your radar lines with your gun, and you call fire() or setFire() in onScannedRobotEvent.

The difference of AngleAssistedBullet from NormalBullet is that NormalBullet will be fired in the direction the gun is pointing at when fire() or setFire() is called, but AngleAssistedBullet will be fired in the direction that onScannedRobotEvent suggested (HOT).

Implementation of this "easter egg" can be found in setFireImpl() in BasicRobotProxy.java of robocode.

Following code is an example of triggering this "easter egg".

package wiki;
import robocode.*;

public class AngleAssistedRobot extends Robot
{
	public void run() {
		while (true) {
			turnGunRight(Double.POSITIVE_INFINITY);
		}
	}

	public void onScannedRobot(ScannedRobotEvent e) {
		fire(1);
	}
}