Class gjt.animation.Playfield
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class gjt.animation.Playfield

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----gjt.animation.Playfield

public class Playfield
extends Canvas
implements Runnable, CollisionArena
A surface upon which Sprites are animated. Playfields are responsible for animating the sprites.

Each Playfield comes complete with two collision detectors: an edge collision detector and a sprite collision detector. Playfield is an abstract class: extensions must implement the following methods:

void paintBackground(Graphics)
void void spriteCollision(Sprite sprite, Sprite other)
void void edgeCollision (Sprite sprite, Sprite other)
See Also:
CollisionArena, Sprite, SpriteCollisionDetector, EdgeCollisionDetector, SimpleAnimationTest, BumpAnimationTest, TwoDrinkersAnimationTest

Variable Index

 o sprites

Constructor Index

 o Playfield()

Method Index

 o addSprite(Sprite)
 o animateSprites()
 o edgeCollision(Sprite, Orientation)
 o getInsets()
 o getSize()
 o getSprites()
 o paint(Graphics)
 o paintBackground(Graphics)
 o paintSprite(Sprite)
 o paintSprites()
 o reshape(int, int, int, int)
 o run()
 o running()
 o setInsets(Insets)
 o spriteCollision(Sprite, Sprite)
 o start()
 o stop()

Variables

 o sprites
  protected Vector sprites

Constructors

 o Playfield
  public Playfield()

Methods

 o paintBackground
  public abstract void paintBackground(Graphics g)
 o stop
  public void stop()
 o running
  public boolean running()
 o getSize
  public Dimension getSize()
 o getInsets
  public Insets getInsets()
 o getSprites
  public Vector getSprites()
 o addSprite
  public void addSprite(Sprite sprite)
 o setInsets
  public void setInsets(Insets insets)
 o start
  public void start()
 o paint
  public void paint(Graphics g)
Overrides:
paint in class Canvas
 o reshape
  public void reshape(int x,
                      int y,
                      int w,
                      int h)
Overrides:
reshape in class Component
 o run
  public void run()
 o animateSprites
  protected void animateSprites()
 o paintSprites
  protected void paintSprites()
 o paintSprite
  protected void paintSprite(Sprite sprite)

All Packages  Class Hierarchy  This Package  Previous  Next  Index