robocode
Class ScannedRobotEvent

java.lang.Object
  extended by robocode.Event
      extended by robocode.ScannedRobotEvent
All Implemented Interfaces:
Comparable<Event>

public class ScannedRobotEvent
extends Event

A ScannedRobotEvent is sent to onScannedRobot(ScannedRobotEvent) when you scan a robot. You can use the information contained in this event to determine what to do.

Author:
Mathew A. Nelson (original)

Constructor Summary
ScannedRobotEvent(String name, double energy, double bearing, double distance, double heading, double velocity)
          Called by the game to create a new ScannedRobotEvent.
 
Method Summary
 double getBearing()
          Returns the bearing to the robot you scanned, relative to your robot's heading, in degrees (-180 <= getBearing() < 180)
 double getBearingRadians()
          Returns the bearing to the robot you scanned, relative to your robot's heading, in radians (-PI <= getBearingRadians() < PI)
 double getDistance()
          Returns the distance to the robot (your center to his center).
 double getEnergy()
          Returns the energy of the robot.
 double getHeading()
          Returns the heading of the robot, in degrees (0 <= getHeading() < 360)
 double getHeadingRadians()
          Returns the heading of the robot, in radians (0 <= getHeading() < 2 * PI)
 double getLife()
          Deprecated. Use getEnergy() instead.
 String getName()
          Returns the name of the robot.
 double getRobotBearing()
          Deprecated. Use getBearing() instead.
 double getRobotBearingDegrees()
          Deprecated. Use getBearing() instead.
 double getRobotBearingRadians()
          Deprecated. Use getBearingRadians() instead.
 double getRobotDistance()
          Deprecated. Use getDistance() instead.
 double getRobotHeading()
          Deprecated. Use getHeading() instead.
 double getRobotHeadingDegrees()
          Deprecated. Use getHeading() instead.
 double getRobotHeadingRadians()
          Deprecated. Use getHeadingRadians() instead.
 double getRobotLife()
          Deprecated. Use getEnergy() instead.
 String getRobotName()
          Deprecated. Use getName() instead.
 double getRobotVelocity()
          Deprecated. Use getVelocity() instead.
 double getVelocity()
          Returns the velocity of the robot.
 
Methods inherited from class robocode.Event
compareTo, getPriority, getTime, setPriority, setTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScannedRobotEvent

public ScannedRobotEvent(String name,
                         double energy,
                         double bearing,
                         double distance,
                         double heading,
                         double velocity)
Called by the game to create a new ScannedRobotEvent.

Parameters:
name - the name of the scanned robot
energy - the energy of the scanned robot
bearing - the bearing of the scanned robot, in radians
distance - the distance from your robot to the scanned robot
heading - the heading of the scanned robot
velocity - the velocity of the scanned robot
Method Detail

getBearing

public double getBearing()
Returns the bearing to the robot you scanned, relative to your robot's heading, in degrees (-180 <= getBearing() < 180)

Returns:
the bearing to the robot you scanned, in degrees

getBearingRadians

public double getBearingRadians()
Returns the bearing to the robot you scanned, relative to your robot's heading, in radians (-PI <= getBearingRadians() < PI)

Returns:
the bearing to the robot you scanned, in radians

getDistance

public double getDistance()
Returns the distance to the robot (your center to his center).

Returns:
the distance to the robot.

getEnergy

public double getEnergy()
Returns the energy of the robot.

Returns:
the energy of the robot

getHeading

public double getHeading()
Returns the heading of the robot, in degrees (0 <= getHeading() < 360)

Returns:
the heading of the robot, in degrees

getHeadingRadians

public double getHeadingRadians()
Returns the heading of the robot, in radians (0 <= getHeading() < 2 * PI)

Returns:
the heading of the robot, in radians

getLife

@Deprecated
public double getLife()
Deprecated. Use getEnergy() instead.


getName

public String getName()
Returns the name of the robot.

Returns:
the name of the robot

getRobotBearing

@Deprecated
public double getRobotBearing()
Deprecated. Use getBearing() instead.


getRobotBearingDegrees

@Deprecated
public double getRobotBearingDegrees()
Deprecated. Use getBearing() instead.


getRobotBearingRadians

@Deprecated
public double getRobotBearingRadians()
Deprecated. Use getBearingRadians() instead.


getRobotDistance

@Deprecated
public double getRobotDistance()
Deprecated. Use getDistance() instead.


getRobotHeading

@Deprecated
public double getRobotHeading()
Deprecated. Use getHeading() instead.


getRobotHeadingDegrees

@Deprecated
public double getRobotHeadingDegrees()
Deprecated. Use getHeading() instead.


getRobotHeadingRadians

@Deprecated
public double getRobotHeadingRadians()
Deprecated. Use getHeadingRadians() instead.


getRobotLife

@Deprecated
public double getRobotLife()
Deprecated. Use getEnergy() instead.


getRobotName

@Deprecated
public String getRobotName()
Deprecated. Use getName() instead.


getRobotVelocity

@Deprecated
public double getRobotVelocity()
Deprecated. Use getVelocity() instead.


getVelocity

public double getVelocity()
Returns the velocity of the robot.

Returns:
the velocity of the robot