|
|||||||||
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 Robot.fireBullet(double)
and AdvancedRobot.setFireBullet(double)
, and all the bullet-related
events.
Robot.fireBullet(double)
,
AdvancedRobot.setFireBullet(double)
,
BulletHitEvent
,
BulletMissedEvent
,
BulletHitBulletEvent
,
Serialized FormConstructor Summary | |
---|---|
Bullet(double heading,
double x,
double y,
double power,
String ownerName,
String victimName,
boolean isActive,
int bulletId)
Called by the game to create a new Bullet object |
Method Summary | |
---|---|
boolean |
equals(Object obj)
|
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). |
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 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. |
int |
hashCode()
|
boolean |
isActive()
Checks if this bullet is still active on the battlefield. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Bullet(double heading, double x, double y, double power, String ownerName, String victimName, boolean isActive, int bulletId)
Bullet
object
heading
- the heading of the bullet, in radians.x
- the starting X position of the bullet.y
- the starting Y position of the bullet.power
- the power of the bullet.ownerName
- the name of the owner robot that owns the bullet.victimName
- the name of the robot hit by the bullet.isActive
- true
if the bullet still moves; false
otherwise.bulletId
- unique id of bullet for owner robot.Method Detail |
---|
public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
public double getHeading()
public double getHeadingRadians()
public String getName()
public double getPower()
public double getVelocity()
public 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 |