simulation_InteractiveVersion
Class BasicSprite

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

public class BasicSprite
extends java.lang.Object
implements Sprite

This class encapsulates a sprite which is a circle of diameter 10 units and color red. The sprite's initial position is randomly chosen. For each frame, this sprite moves 1 unit down and 1 unit to the right, wrapping around the canvas when the boundaries are encountered.

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(java.awt.Graphics2D g)
          Takes the passed Graphics2D object and specifies how this sprite should be drawn on it.
 void move()
          Specify what should happen at each frame.
 void setPaint(java.awt.Paint p)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, 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

setPaint

public void setPaint(java.awt.Paint p)

draw

public void draw(java.awt.Graphics2D g)
Description copied from interface: Sprite
Takes the passed Graphics2D object and specifies how this sprite should be drawn on it.

Specified by:
draw in interface Sprite

move

public void move()
Description copied from interface: Sprite
Specify what should happen at each frame.

Specified by:
move in interface Sprite