simulation_MVC_Basic
Class ShooterSprite

java.lang.Object
  extended by simulation_MVC_Basic.ShooterSprite
All Implemented Interfaces:
Sprite

public class ShooterSprite
extends java.lang.Object
implements Sprite

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.

Author:
mb Version 2.0 of this class

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

logger

public static java.util.logging.Logger logger
Constructor Detail

ShooterSprite

public ShooterSprite(java.awt.Dimension worldDimension)
Creates a shooter sprite with the specified game world dimensions.

Parameters:
worldDimension - as described above
Method Detail

draw

public void draw(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:
draw 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

fire

public 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.

Returns:
as described above

getPointsValue

public int getPointsValue()
Description copied from interface: Sprite
Returns the points value that is associated with hitting this sprite with a projectile

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

moveUp

public void moveUp()
Cause the shooter sprite to move up, but not past the world boundary


moveDown

public void moveDown()
Cause the shooter sprite to move down, but not past the world boundary


moveLeft

public void moveLeft()
Cause the shooter sprite to move left, but not past the world boundary


moveRight

public void moveRight()
Cause the shooter sprite to move right, but not past the world boundary


rotateLeft

public void rotateLeft()
Cause the shooter sprite to rotate to the left (counter-clockwise)


rotateRight

public void rotateRight()
Cause the shooter sprite to rotate to the right (clockwise)