visual.dynamic.described
Class RuleBasedSprite

java.lang.Object
  extended by visual.dynamic.described.AbstractSprite
      extended by visual.dynamic.described.RuleBasedSprite
All Implemented Interfaces:
MetronomeListener, Sprite, SimpleContent, TransformableContent

public abstract class RuleBasedSprite
extends AbstractSprite

An abstract rule-based Sprite Note: Concrete descendents must implement the handleTick() method

See Also:
"The Design and Implementation of Multimedia Software © 2011"

Field Summary
protected  java.util.ArrayList<Sprite> antagonists
           
protected  TransformableContent content
           
 
Fields inherited from class visual.dynamic.described.AbstractSprite
angle, rotationPoint, rotationX, rotationY, scaleX, scaleY, visible, x, y
 
Constructor Summary
RuleBasedSprite(TransformableContent content)
          Explicit Value Constructor
 
Method Summary
 void addAntagonist(Sprite antagonist)
          Add a "antagonist" Sprite to this Sprite
 TransformableContent getContent()
          Get the visual content associated with this Sprite (required by Sprite)
abstract  void handleTick(int time)
          Handle a tick event (required by MetronomeListener)
 void removeAntagonist(Sprite antagonist)
          Remove a "antagonist" Sprite from the collection of "antagonists" this Sprite is concerned with
 
Methods inherited from class visual.dynamic.described.AbstractSprite
getBounds2D, getBounds2D, intersects, reinitialize, render, setLocation, setRotation, setRotation, setScale, setScale, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

antagonists

protected java.util.ArrayList<Sprite> antagonists

content

protected TransformableContent content
Constructor Detail

RuleBasedSprite

public RuleBasedSprite(TransformableContent content)
Explicit Value Constructor

Parameters:
content - The static visual content
Method Detail

addAntagonist

public void addAntagonist(Sprite antagonist)
Add a "antagonist" Sprite to this Sprite

Parameters:
antagonist - The "antagonist" Sprite to add

getContent

public TransformableContent getContent()
Get the visual content associated with this Sprite (required by Sprite)

Specified by:
getContent in class AbstractSprite

handleTick

public abstract void handleTick(int time)
Handle a tick event (required by MetronomeListener)

Specified by:
handleTick in interface MetronomeListener
Specified by:
handleTick in class AbstractSprite
Parameters:
time - The current time (in milliseconds)

removeAntagonist

public void removeAntagonist(Sprite antagonist)
Remove a "antagonist" Sprite from the collection of "antagonists" this Sprite is concerned with

Parameters:
antagonist - The "antagonist" Sprite to remove


Design and Implementation of Multimedia Software, Jones and Bartlett Publishers