|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrobocode.Bullet
public class Bullet
Represents a bullet. This is returned from fireBullet() and setFireBullet(), and all the bullet-related events.
Robot.fireBullet(double)
,
AdvancedRobot.setFireBullet(double)
,
BulletHitEvent
,
BulletMissedEvent
,
BulletHitBulletEvent
Constructor Summary | |
---|---|
Bullet(robocode.peer.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). |
double |
getHeadingRadians()
Returns the direction the bullet is/was heading, in radians (0 <= getHeadingRadians() < 2 * Math.PI). |
java.lang.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. |
java.lang.String |
getVictim()
Returns the name of the robot that this bullet hit, or null if
the bullet has not hit a robot. |
double |
getX()
Returns the X position of the bullet. |
double |
getY()
Returns the Y position of the bullet. |
boolean |
isActive()
Checks if this bullet is still active on the battlefield. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Bullet(robocode.peer.BulletPeer peer)
Method Detail |
---|
public double getHeading()
public double getHeadingRadians()
public java.lang.String getName()
public double getPower()
The bullet will do (4 * power) damage if it hits another robot. If power is greater than 1, it will do an additional 2 * (power - 1) damage. You will get (3 * power) back if you hit the other robot.
public double getVelocity()
public java.lang.String getVictim()
null
if
the bullet has not hit a robot.
null
if
the bullet has not hit a robot.public double getX()
public double getY()
public boolean isActive()
true
if the bullet is still active on the battlefield;
false
otherwise
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |