simulation_MVC_Basic
Class ScoreTallySprite

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

public class ScoreTallySprite
extends java.lang.Object
implements Sprite

This class encapsulates an on-screen score tally.

Author:
mb

Constructor Summary
ScoreTallySprite(java.awt.Dimension dimensionOfDrawingRegion)
          Constructs a sprite located in the upper left corner.
 
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.
 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 registerAmmoUsed()
          Update the cumulative ammo tally by one.
 void registerHit(Sprite theTarget)
          Registers that a hit was accomplished on the target that is passed as a parameter.
 void resetAmmoTally()
          Reset the cumulative ammo back to zero.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScoreTallySprite

public ScoreTallySprite(java.awt.Dimension dimensionOfDrawingRegion)
Constructs a sprite located in the upper left corner.

Parameters:
dimensionOfDrawingRegion -
Method Detail

draw

public void draw(java.awt.Graphics2D g)
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

registerHit

public void registerHit(Sprite theTarget)
Registers that a hit was accomplished on the target that is passed as a parameter.

Parameters:
theTarget -

registerAmmoUsed

public void registerAmmoUsed()
Update the cumulative ammo tally by one.


resetAmmoTally

public void resetAmmoTally()
Reset the cumulative ammo back to zero.


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