Package robocode.control.snapshot
Interface IBulletSnapshot
public interface IBulletSnapshot
Interface of a bullet snapshot at a specific time in a battle.
- Since:
- 1.6.2
- Author:
- Pavel Savara (original), Flemming N. Larsen (contributor)
-
Method Summary
Modifier and TypeMethodDescriptionintReturns the ID of the bullet used for identifying the bullet in a collection of bullets.intgetColor()Returns the color of the bullet.intReturns the explosion image index, which is different depending on the type of explosion.intgetFrame()Returns the current frame number to display, i.e.doubleintdoubleReturns the X painting position of the bullet.doubleReturns the Y painting position of the bullet.doublegetPower()Returns the bullet power.getState()Returns the bullet state.intdoublegetX()Returns the X position of the bullet.doublegetY()Returns the Y position of the bullet.booleanChecks if the bullet has become an explosion, i.e.
-
Method Details
-
getState
BulletState getState()Returns the bullet state.- Returns:
- the bullet state.
-
getPower
double getPower()Returns the bullet power.- Returns:
- the bullet power.
-
getX
double getX()Returns the X position of the bullet.- Returns:
- the X position of the bullet.
-
getY
double getY()Returns the Y position of the bullet.- Returns:
- the Y position of the bullet.
-
getPaintX
double getPaintX()Returns the X painting position of the bullet. Note that this is not necessarily equal to the X position of the bullet, even though it will be in most cases. The painting position of the bullet is needed as the bullet will "stick" to its victim when it has been hit, but only visually.- Returns:
- the X painting position of the bullet.
-
getPaintY
double getPaintY()Returns the Y painting position of the bullet. Note that this is not necessarily equal to the Y position of the bullet, even though it will be in most cases. The painting position of the bullet is needed as the bullet will "stick" to its victim when it has been hit, but only visually.- Returns:
- the Y painting position of the bullet.
-
getColor
int getColor()Returns the color of the bullet.- Returns:
- an ARGB color value. (Bits 24-31 are alpha, 16-23 are red, 8-15 are green, 0-7 are blue)
- See Also:
-
getFrame
int getFrame()Returns the current frame number to display, i.e. when the bullet explodes.- Returns:
- the current frame number.
- See Also:
-
isExplosion
boolean isExplosion()Checks if the bullet has become an explosion, i.e. when it a robot or bullet has been hit.- Returns:
trueif the bullet is an explosion;falseotherwise.- See Also:
-
getExplosionImageIndex
int getExplosionImageIndex()Returns the explosion image index, which is different depending on the type of explosion. E.g. if it is a small explosion on a robot that has been hit by this bullet, or a big explosion when a robot dies.- Returns:
- the explosion image index.
- See Also:
-
getBulletId
int getBulletId()Returns the ID of the bullet used for identifying the bullet in a collection of bullets.- Returns:
- the ID of the bullet.
-
getHeading
double getHeading()- Returns:
- heading of the bullet
-
getVictimIndex
int getVictimIndex()- Returns:
- contestantIndex of the victim, or -1 if still in air
-
getOwnerIndex
int getOwnerIndex()- Returns:
- contestantIndex of the owner
-