|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectgameComponents_LT3.BasicTriangleShooter
public class BasicTriangleShooter
This class encapsulates an on-screen sprite that represents a shooter in our asteroids-like video game. This class supports linear translation of the sprite along the x and y dimensions. It does not support rotation yet.
Constructor Summary | |
---|---|
BasicTriangleShooter(java.awt.Dimension dimensionOfDrawingRegion)
Constructs a sprite located at the 0,0 position |
Method Summary | |
---|---|
ProjectileSprite |
fire()
Method creates a ProjectileSprite located at tip of this shooter. |
java.awt.geom.Rectangle2D |
getBounds2D()
This method returns a rectangular box that completely encloses this sprite. |
void |
moveDown()
Move this sprite down one "vertical unit" (the size of this unit is determined by a class attribute). |
void |
moveLeft()
Move this sprite left one "horizontal unit" (the size of this unit is determined by a class attribute). |
void |
moveRight()
Move this sprite right one "horizontal unit" (the size of this unit is determined by a class attribute). |
void |
moveUp()
Move this sprite up one "vertical unit" (the size of this unit is determined by a class attribute). |
void |
rotateLeft()
Rotate this sprite one "rotational unit" in a counterclockwise direction (the size of this unit is determined by a class attribute). |
void |
rotateRight()
Rotate this sprite one "rotational unit" in a clockwise direction (the size of this unit is determined by a class attribute). |
void |
setInitialLocation()
Position this sprite in the initial location. |
void |
specifyDrawing(java.awt.Graphics2D g)
This method takes the passed Graphics2D object and specifies how this sprite should be drawn on it. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BasicTriangleShooter(java.awt.Dimension dimensionOfDrawingRegion)
dimensionOfDrawingRegion
- Method Detail |
---|
public void specifyDrawing(java.awt.Graphics2D g)
Sprite
specifyDrawing
in interface Sprite
public java.awt.geom.Rectangle2D getBounds2D()
Sprite
getBounds2D
in interface Sprite
public void moveUp()
ShooterSprite
moveUp
in interface ShooterSprite
public void moveDown()
ShooterSprite
moveDown
in interface ShooterSprite
public void moveLeft()
ShooterSprite
moveLeft
in interface ShooterSprite
public void moveRight()
ShooterSprite
moveRight
in interface ShooterSprite
public void rotateLeft()
ShooterSprite
rotateLeft
in interface ShooterSprite
public void setInitialLocation()
ShooterSprite
setInitialLocation
in interface ShooterSprite
public ProjectileSprite fire()
ShooterSprite
fire
in interface ShooterSprite
public void rotateRight()
ShooterSprite
rotateRight
in interface ShooterSprite
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |