simulation_Lab06Version
Class BasicSpriteTypeVertical
java.lang.Object
simulation_Lab06Version.BasicSpriteTypeVertical
- All Implemented Interfaces:
- Sprite
public class BasicSpriteTypeVertical
- 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 displacement is added.
- Author:
- mb
Constructor Summary |
BasicSpriteTypeVertical(int widthOfDrawingRegion,
int heightOfDrawingRegion)
Creates a basic sprite within a game world with the specified dimensions. |
BasicSpriteTypeVertical
public BasicSpriteTypeVertical(int widthOfDrawingRegion,
int heightOfDrawingRegion)
- Creates a basic sprite within a game world with the specified dimensions.
- Parameters:
widthOfDrawingRegion
- as described aboveheightOfDrawingRegion
- as described above
draw
public void draw(Graphics2D graphics2D)
- Specified by:
draw
in interface Sprite
move
public void move()
- Specified by:
move
in interface Sprite