robocode
Class Bullet

java.lang.Object
  |
  +--robocode.Bullet

public class Bullet
extends Object

Represents a bullet. This is returned from fireBullet(), and all the bullet-related events.

See Also:
Robot.fireBullet(double), BulletHitBulletEvent, BulletHitEvent, BulletMissedEvent

Constructor Summary
Bullet(BulletPeer peer)
          Called by the game to create a Bullet object
 
Method Summary
 double getHeading()
          Returns the direction the bullet is/was heading, in degrees (0 <= getHeading() < 360) This is not relative to the direction you are facing.
 double getHeadingRadians()
          Returns the direction the bullet is/was heading, in radians (0 <= getHeadingRadians() < 2 * Math.PI) This is not relative to the direction you are facing.
 String getName()
          Returns the name of the robot that fired this bullet
 double getPower()
          Returns the power of this bullet.
 double getVelocity()
          Returns the velocity of this bullet.
 String getVictim()
          Returns the name of the robot that this bullet hit, or null.
 double getX()
          Returns the x position of the bullet.
 double getY()
          Returns the y position of the bullet.
 boolean isActive()
          Returns true if the bullet is still on the battlefield, false otherwise.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Bullet

public Bullet(BulletPeer peer)
Called by the game to create a Bullet object

Method Detail

getHeading

public double getHeading()
Returns the direction the bullet is/was heading, in degrees (0 <= getHeading() < 360) This is not relative to the direction you are facing.

Returns:
direction the bullet is/was heading.

getHeadingRadians

public double getHeadingRadians()
Returns the direction the bullet is/was heading, in radians (0 <= getHeadingRadians() < 2 * Math.PI) This is not relative to the direction you are facing.

Returns:
direction the bullet is/was heading.

getName

public String getName()
Returns the name of the robot that fired this bullet

Returns:
the name of the robot that fired this bullet

getPower

public double getPower()
Returns the power of this bullet. The damage you take (in fact, already took) is 4 * power. The robot that fired the bullet receives 1.5 * power back.

Returns:
power of the bullet.

getVelocity

public double getVelocity()
Returns the velocity of this bullet. Currently, this is a constant.

Returns:
velocity of the bullet that hit you

getVictim

public String getVictim()
Returns the name of the robot that this bullet hit, or null.

Returns:
the name of the robot that fired this bullet

getX

public double getX()
Returns the x position of the bullet.

Returns:
the x position of the bullet.

getY

public double getY()
Returns the y position of the bullet.

Returns:
the y position of the bullet.

isActive

public boolean isActive()
Returns true if the bullet is still on the battlefield, false otherwise.

Returns:
true if the bullet is still on the battlefield.