game
Class MovingGraphics

java.lang.Object
  extended by game.MovingBody
      extended by game.MovingGraphics
All Implemented Interfaces:
Animated
Direct Known Subclasses:
FancyDart, MovingPicture

public class MovingGraphics
extends MovingBody

Manage a set of shapes that move in concert with a supplied trajectory. Each shape can be offset from the trajectory by a specified amount.


Field Summary
 
Fields inherited from class game.MovingBody
lr, outOfBounds, start, ul
 
Constructor Summary
MovingGraphics(Controller controller, Trackable trajectory, Point ul, Point lr)
           
 
Method Summary
 void addGraphic(Graphic shape, Vector delta)
          Include the specified shape in this MovingBody.
 void respondAfterTick()
          Responds by relocating each shape, relative to the trajectory, and offset by its delta.
 void respondToDeath()
          Responds by removing each shape from the controller's display.
 
Methods inherited from class game.MovingBody
die, getLocation, getStart, inBounds, isDone, setTrajectory, tick
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MovingGraphics

public MovingGraphics(Controller controller,
                      Trackable trajectory,
                      Point ul,
                      Point lr)
Method Detail

addGraphic

public void addGraphic(Graphic shape,
                       Vector delta)
Include the specified shape in this MovingBody. The shape is added to the controller's display, so it appears immediately

Parameters:
shape - The shape to be managed
delta - The offset from the trajectory at which this shape should move.

respondAfterTick

public void respondAfterTick()
Responds by relocating each shape, relative to the trajectory, and offset by its delta.

Specified by:
respondAfterTick in class MovingBody

respondToDeath

public void respondToDeath()
Responds by removing each shape from the controller's display. TBD: after death, we should tick no more, and some code shouold be deployed to prevent such a thing.

Specified by:
respondToDeath in class MovingBody