gameComponents_LT3
Class BasicTriangleShooter

java.lang.Object
  extended by gameComponents_LT3.BasicTriangleShooter
All Implemented Interfaces:
ShooterSprite, Sprite

public class BasicTriangleShooter
extends java.lang.Object
implements ShooterSprite

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.

Author:
mb Version 2.0 of this class

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

BasicTriangleShooter

public BasicTriangleShooter(java.awt.Dimension dimensionOfDrawingRegion)
Constructs a sprite located at the 0,0 position

Parameters:
dimensionOfDrawingRegion -
Method Detail

specifyDrawing

public void specifyDrawing(java.awt.Graphics2D g)
Description copied from interface: Sprite
This method takes the passed Graphics2D object and specifies how this sprite should be drawn on it.

Specified by:
specifyDrawing in interface Sprite

getBounds2D

public java.awt.geom.Rectangle2D getBounds2D()
Description copied from interface: Sprite
This method returns a rectangular box that completely encloses this sprite. The bounding box can be assumed to be the smallest bounding box that is possible.

Specified by:
getBounds2D in interface Sprite
Returns:
as described above

moveUp

public void moveUp()
Description copied from interface: ShooterSprite
Move this sprite up one "vertical unit" (the size of this unit is determined by a class attribute).

Specified by:
moveUp in interface ShooterSprite

moveDown

public void moveDown()
Description copied from interface: ShooterSprite
Move this sprite down one "vertical unit" (the size of this unit is determined by a class attribute).

Specified by:
moveDown in interface ShooterSprite

moveLeft

public void moveLeft()
Description copied from interface: ShooterSprite
Move this sprite left one "horizontal unit" (the size of this unit is determined by a class attribute).

Specified by:
moveLeft in interface ShooterSprite

moveRight

public void moveRight()
Description copied from interface: ShooterSprite
Move this sprite right one "horizontal unit" (the size of this unit is determined by a class attribute).

Specified by:
moveRight in interface ShooterSprite

rotateLeft

public void rotateLeft()
Description copied from interface: ShooterSprite
Rotate this sprite one "rotational unit" in a counterclockwise direction (the size of this unit is determined by a class attribute).

Specified by:
rotateLeft in interface ShooterSprite

setInitialLocation

public void setInitialLocation()
Description copied from interface: ShooterSprite
Position this sprite in the initial location.

Specified by:
setInitialLocation in interface ShooterSprite

fire

public ProjectileSprite fire()
Description copied from interface: ShooterSprite
Method creates a ProjectileSprite located at tip of this shooter.

Specified by:
fire in interface ShooterSprite

rotateRight

public void rotateRight()
Description copied from interface: ShooterSprite
Rotate this sprite one "rotational unit" in a clockwise direction (the size of this unit is determined by a class attribute).

Specified by:
rotateRight in interface ShooterSprite