robocode
Class HitByBulletEvent
- Comparable
public class HitByBulletEvent
A HitByBulletEvent is sent to
onHitByBullet(HitByBulletEvent)
when your robot has been hit by a bullet.
You can use the information contained in this event to determine what to do.
- Mathew A. Nelson (original)
@Deprecated | double getHeadingDegrees() - Use
getHeading() instead.
|
double | getBearing() - Returns the bearing to the bullet, relative to your robot's heading,
in degrees (-180 <32getBearing() <= 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 <32getBearingRadians() <= 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() <32360)
Note: This is not relative to the direction you are facing.
|
double | getHeadingRadians() - Returns the heading of the bullet when it hit you, in radians
(0 <= getHeadingRadians() <322 * 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.
|
HitByBulletEvent
public HitByBulletEvent(double bearing,
Bullet bullet)
Called by the game to create a new HitByBulletEvent.
bearing
- the bearing of the bullet that hit your robot, in radiansbullet
- the bullet that has hit your robot
double getHeadingDegrees
public @Deprecated double getHeadingDegrees()
Use getHeading()
instead.
- the heading of the bullet, in degrees
getBearing
public double getBearing()
Returns the bearing to the bullet, relative to your robot's heading,
in degrees (-180 <32getBearing() <= 180)
If you were to turnRight(e.getBearing()), you would be facing the
direction the bullet came from. The calculation used here is:
(bullet's heading in degrees + 180) - (your heading in degrees)
- the bearing to the bullet, in degrees
getBearingRadians
public double getBearingRadians()
Returns the bearing to the bullet, relative to your robot's heading,
in radians (-Math.PI <32getBearingRadians() <= Math.PI)
If you were to turnRightRadians(e.getBearingRadians()), you would be
facing the direction the bullet came from. The calculation used here is:
(bullet's heading in radians + Math.PI) - (your heading in radians)
- the bearing to the bullet, in radians
getBullet
public Bullet getBullet()
Returns the bullet that hit your robot.
- the bullet that hit your robot
getHeading
public double getHeading()
Returns the heading of the bullet when it hit you, in degrees
(0 <= getHeading() <32360)
Note: This is not relative to the direction you are facing. The robot
that fired the bullet was in the opposite direction of getHeading() when
it fired the bullet.
- the heading of the bullet, in degrees
getHeadingRadians
public double getHeadingRadians()
Returns the heading of the bullet when it hit you, in radians
(0 <= getHeadingRadians() <322 * PI)
Note: This is not relative to the direction you are facing. The robot
that fired the bullet was in the opposite direction of
getHeadingRadians() when it fired the bullet.
- the heading of the bullet, in radians
getName
public String getName()
Returns the name of the robot that fired the bullet.
- the name of the robot that fired the bullet
getPower
public double getPower()
Returns the power of this bullet. The damage you take (in fact, already
took) is 4 * power, plus 2 * (power-1) if power > 1. The robot that fired
the bullet receives 3 * power back.
getVelocity
public double getVelocity()
Returns the velocity of this bullet.
- the velocity of the bullet