public class Bullet extends Sprite
EXIT_POLICY_BOUNCE, EXIT_POLICY_DIE, EXIT_POLICY_STOP, EXIT_POLICY_WRAP| Constructor and Description |
|---|
Bullet(double x,
double y,
double dx,
double dy)
Creates a bullet at a specified location and with a specified velocity.
|
| Modifier and Type | Method and Description |
|---|---|
void |
detonate()
Kill the bullet and, if it is exploding, add an Explosion to the SpritePanel.
|
void |
draw(java.awt.Graphics g)
This method is called by the SpritePanel to tell the sprite to draw itself.
|
boolean |
getExploding() |
void |
setColor(java.awt.Color c)
Change the color of this Bullet.
|
void |
setExploding(boolean b)
Sets the "exploding" property of this Bullet to true or false.
|
contains, die, getDx, getDy, getExitPolicy, getHome, getSpriteHeight, getSpriteWidth, getX, getY, isDead, isImmuneToBullets, onDeath, prepareForNextFrame, randomVelocity, setDx, setDy, setExitPolicy, setImmuneToBullets, setLocation, setSpriteHeight, setSpriteWidth, setUseOvalForContains, setVelocity, setX, setYpublic Bullet(double x,
double y,
double dx,
double dy)
x - the x-component of the initial locationy - the y-component of the initial locationdx - the x-component of the velocitydy - the y-component of the velocitypublic void detonate()
public void draw(java.awt.Graphics g)
Spritepublic boolean getExploding()
public void setColor(java.awt.Color c)
public void setExploding(boolean b)