robocode

Class ScannedRobotEvent

Implemented Interfaces:
Comparable, Serializable

public final class ScannedRobotEvent
extends Event

A ScannedRobotEvent is sent to onScannedRobot() 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

@Deprecated
String getRobotName()
Deprecated. Use getName() instead.
@Deprecated
double getLife()
Deprecated. Use getEnergy() instead.
@Deprecated
double getRobotBearing()
Deprecated. Use getBearing() instead.
@Deprecated
double getRobotBearingDegrees()
Deprecated. Use getBearing() instead.
@Deprecated
double getRobotBearingRadians()
Deprecated. Use getBearingRadians() instead.
@Deprecated
double getRobotDistance()
Deprecated. Use getDistance() instead.
@Deprecated
double getRobotHeading()
Deprecated. Use getHeading() instead.
@Deprecated
double getRobotHeadingDegrees()
Deprecated. Use getHeading() instead.
@Deprecated
double getRobotHeadingRadians()
Deprecated. Use getHeadingRadians() instead.
@Deprecated
double getRobotLife()
Deprecated. Use getEnergy() instead.
@Deprecated
double getRobotVelocity()
Deprecated. Use getVelocity() instead.
double
getBearing()
Returns the bearing to the robot you scanned, relative to your robot's heading, in degrees (-180 <= getBearing() <32180)
double
getBearingRadians()
Returns the bearing to the robot you scanned, relative to your robot's heading, in radians (-PI <= getBearingRadians() <32PI)
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() <32360)
double
getHeadingRadians()
Returns the heading of the robot, in radians (0 <= getHeading() <322 * PI)
String
getName()
Returns the name of the robot.
double
getVelocity()
Returns the velocity of the robot.
@Override
int compareTo(Event event)

Methods inherited from class robocode.Event

compareTo, getPriority, getTime

Constructor Details

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 Details

String getRobotName

public @Deprecated String getRobotName()

Deprecated. Use getName() instead.

Returns:
the name of the robot

double getLife

public @Deprecated double getLife()

Deprecated. Use getEnergy() instead.

Returns:
the energy of the robot

double getRobotBearing

public @Deprecated double getRobotBearing()

Deprecated. Use getBearing() instead.

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

double getRobotBearingDegrees

public @Deprecated double getRobotBearingDegrees()

Deprecated. Use getBearing() instead.

Returns:
the robot bearing in degrees

double getRobotBearingRadians

public @Deprecated double getRobotBearingRadians()

Deprecated. Use getBearingRadians() instead.

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

double getRobotDistance

public @Deprecated double getRobotDistance()

Deprecated. Use getDistance() instead.

Returns:
the distance to the robot.

double getRobotHeading

public @Deprecated double getRobotHeading()

Deprecated. Use getHeading() instead.

Returns:
the heading of the robot, in degrees

double getRobotHeadingDegrees

public @Deprecated double getRobotHeadingDegrees()

Deprecated. Use getHeading() instead.

Returns:
the heading of the robot, in degrees

double getRobotHeadingRadians

public @Deprecated double getRobotHeadingRadians()

Deprecated. Use getHeadingRadians() instead.

Returns:
the heading of the robot, in radians

double getRobotLife

public @Deprecated double getRobotLife()

Deprecated. Use getEnergy() instead.

Returns:
the energy of the robot

double getRobotVelocity

public @Deprecated double getRobotVelocity()

Deprecated. Use getVelocity() instead.

Returns:
the velocity of the robot

getBearing

public double getBearing()
Returns the bearing to the robot you scanned, relative to your robot's heading, in degrees (-180 <= getBearing() <32180)
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() <32PI)
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() <32360)
Returns:
the heading of the robot, in degrees

getHeadingRadians

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

getName

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

getVelocity

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

int compareTo

public final @Override int compareTo(Event event)