simulation_Lab06Version
Class BasicSprite

java.lang.Object
  extended by simulation_Lab06Version.BasicSprite
All Implemented Interfaces:
Sprite

public class BasicSprite
extends Object
implements Sprite

This class encapsulates a sprite which is a circle of diameter 30 units. The sprite is initially black and lightens with time; when the colour reaches white, the process starts over. The sprite's initial position is at the top left. For each frame, the sprite moves 1 unit down and 1 unit to the right, wrapping around the canvas when the boundaries are encountered. To this basic move a uniformly distributed random perturbation in [-10,10] in vertical and horizontal displacement are added.

Author:
mb

Constructor Summary
BasicSprite(int widthOfDrawingRegion, int heightOfDrawingRegion)
          Creates a basic sprite within a game world with the specified dimensions.
 
Method Summary
 void draw(Graphics2D graphics2D)
           
 void move()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicSprite

public BasicSprite(int widthOfDrawingRegion,
                   int heightOfDrawingRegion)
Creates a basic sprite within a game world with the specified dimensions.

Parameters:
widthOfDrawingRegion - as described above
heightOfDrawingRegion - as described above
Method Detail

draw

public void draw(Graphics2D graphics2D)
Specified by:
draw in interface Sprite

move

public void move()
Specified by:
move in interface Sprite