game
Class Wiggle

java.lang.Object
  extended by game.Wiggle
All Implemented Interfaces:
Trackable

public class Wiggle
extends java.lang.Object
implements Trackable

Causes the Trackable location to wiggle from its starting Point.


Constructor Summary
Wiggle(Point start, int radius)
          Specify a Wiggle
 
Method Summary
 int advanceTime(int milliseconds)
          Mark the advance of time.
 Point getLocation()
          Where are we now?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Wiggle

public Wiggle(Point start,
              int radius)
Specify a Wiggle

Parameters:
start - Center of the wiggling and starting location
radius - The Trackable location will not move beyond the specified radius
Method Detail

advanceTime

public int advanceTime(int milliseconds)
Mark the advance of time. Every so often, pick a new destination for the wiggle. Each time, update the current location by moving some fraction toward the destination.

Specified by:
advanceTime in interface Trackable
Returns:
The current time after the update.

getLocation

public Point getLocation()
Where are we now?

Specified by:
getLocation in interface Trackable
Returns:
current location