|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimulation_MVC_Basic.ShooterSprite
public class ShooterSprite
This class encapsulates an on-screen sprite that is a masked bit-map of a beetle that shoots projectiles from its head. This class supports linear translation of the sprite along the x and y dimensions and angular rotation.
Field Summary | |
---|---|
static java.util.logging.Logger |
logger
|
Constructor Summary | |
---|---|
ShooterSprite(java.awt.Dimension worldDimension)
Creates a shooter sprite with the specified game world dimensions. |
Method Summary | |
---|---|
void |
draw(java.awt.Graphics2D g)
This method takes the passed Graphics2D object and specifies how this sprite should be drawn on it. |
ProjectileSprite |
fire()
Instantiates a projectile sprite that has initial position from the shooter tip of this sprite and that has a trajectory that is consistent with the angular rotation of this sprite. |
java.awt.geom.Rectangle2D |
getBounds2D()
This method returns a rectangular box that completely encloses this sprite. |
int |
getPointsValue()
Returns the points value that is associated with hitting this sprite with a projectile |
void |
moveDown()
Cause the shooter sprite to move down, but not past the world boundary |
void |
moveLeft()
Cause the shooter sprite to move left, but not past the world boundary |
void |
moveRight()
Cause the shooter sprite to move right, but not past the world boundary |
void |
moveUp()
Cause the shooter sprite to move up, but not past the world boundary |
void |
rotateLeft()
Cause the shooter sprite to rotate to the left (counter-clockwise) |
void |
rotateRight()
Cause the shooter sprite to rotate to the right (clockwise) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.util.logging.Logger logger
Constructor Detail |
---|
public ShooterSprite(java.awt.Dimension worldDimension)
worldDimension
- as described aboveMethod Detail |
---|
public void draw(java.awt.Graphics2D g)
Sprite
draw
in interface Sprite
public java.awt.geom.Rectangle2D getBounds2D()
Sprite
getBounds2D
in interface Sprite
public ProjectileSprite fire()
public int getPointsValue()
Sprite
getPointsValue
in interface Sprite
public void moveUp()
public void moveDown()
public void moveLeft()
public void moveRight()
public void rotateLeft()
public void rotateRight()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |