public final class HitByBulletEvent extends Event
onHitByBullet()
when your robot has been hit by a bullet.
You can use the information contained in this event to determine what to do.Constructor and Description |
---|
HitByBulletEvent(double bearing,
Bullet bullet)
Called by the game to create a new HitByBulletEvent.
|
Modifier and Type | Method and Description |
---|---|
double |
getBearing()
Returns the bearing to the bullet, relative to your robot's heading,
in degrees (-180 < getBearing() <= 180)
If you were to turnRight(e.getBearing()), you would be facing the
direction the bullet came from.
|
double |
getBearingRadians()
Returns the bearing to the bullet, relative to your robot's heading,
in radians (-Math.PI < getBearingRadians() <= Math.PI)
If you were to turnRightRadians(e.getBearingRadians()), you would be
facing the direction the bullet came from.
|
Bullet |
getBullet()
Returns the bullet that hit your robot.
|
double |
getHeading()
Returns the heading of the bullet when it hit you, in degrees
(0 <= getHeading() < 360)
Note: This is not relative to the direction you are facing.
|
double |
getHeadingDegrees()
Deprecated.
Use
getHeading() instead. |
double |
getHeadingRadians()
Returns the heading of the bullet when it hit you, in radians
(0 <= getHeadingRadians() < 2 * PI)
Note: This is not relative to the direction you are facing.
|
String |
getName()
Returns the name of the robot that fired the bullet.
|
double |
getPower()
Returns the power of this bullet.
|
double |
getVelocity()
Returns the velocity of this bullet.
|
compareTo, getPriority, getTime
public HitByBulletEvent(double bearing, Bullet bullet)
bearing
- the bearing of the bullet that hit your robot, in radiansbullet
- the bullet that has hit your robotpublic double getBearing()
public double getBearingRadians()
public Bullet getBullet()
public double getHeading()
@Deprecated public double getHeadingDegrees()
getHeading()
instead.public double getHeadingRadians()
public String getName()
public double getPower()
public double getVelocity()