|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectrobocode.Event
robocode.HitRobotEvent
public final class HitRobotEvent
A HitRobotEvent is sent to onHitRobot()
when your robot collides with another robot.
You can use the information contained in this event to determine what to do.
| Constructor Summary | |
|---|---|
HitRobotEvent(String name,
double bearing,
double energy,
boolean atFault)
Called by the game to create a new HitRobotEvent. |
|
| Method Summary | |
|---|---|
int |
compareTo(Event event)
Compares this event to another event regarding precedence. |
double |
getBearing()
Returns the bearing to the robot you hit, relative to your robot's heading, in degrees (-180 <= getBearing() < 180) |
double |
getBearingDegrees()
Deprecated. Use getBearing() instead. |
double |
getBearingRadians()
Returns the bearing to the robot you hit, relative to your robot's heading, in radians (-PI <= getBearingRadians() < PI) |
double |
getEnergy()
Returns the amount of energy of the robot you hit. |
String |
getName()
Returns the name of the robot you hit. |
String |
getRobotName()
Deprecated. Use getName() instead. |
boolean |
isMyFault()
Checks if your robot was moving towards the robot that was hit. |
| Methods inherited from class robocode.Event |
|---|
getPriority, getTime, setPriority, setTime |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HitRobotEvent(String name,
double bearing,
double energy,
boolean atFault)
name - the name of the robot you hitbearing - the bearing to the robot that your robot hit, in radiansenergy - the amount of energy of the robot you hitatFault - true if your robot was moving toward the other
robot; false otherwise| Method Detail |
|---|
public double getBearing()
@Deprecated public double getBearingDegrees()
getBearing() instead.
public double getBearingRadians()
public double getEnergy()
public String getName()
@Deprecated public String getRobotName()
getName() instead.
public boolean isMyFault()
isMyFault() returns true then your robot's movement
(including turning) will have stopped and been marked complete.
Note: If two robots are moving toward each other and collide, they will
each receive two HitRobotEvents. The first will be the one if
isMyFault() returns true.
true if your robot was moving towards the robot that was
hit; false otherwise.public final int compareTo(Event event)
compareTo in interface Comparable<Event>compareTo in class Eventevent - the event to compare to this event.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||