ming radar and gun are aligned... if (event.getDistance() < 100) { fire(3); } else { fire(1); } }
Note: The game assists Robots in firing, as follows:
- If the gun and radar are aligned (and were aligned last turn),
- and the event is current,
- and you call fire() before taking any other actions, {@link Robot#fire(double) fire()} will fire directly at the robot.
In essence, this means that if you can see a robot, and it doesn't move, then fire will hit it.
AdvancedRobots will NOT be assisted in this manner, and are expected to examine the event to determine if {@link Robot#fire(double) fire()} wouldhit. (i.e. you are spinning your gun around, but by the time you get the event, your gun is 5 degrees past the robot).
@param event the scanned-robot event set by the game
@see ScannedRobotEvent
@see Event
@see Rules#RADAR_SCAN_RADIUS