import java.applet.*;
import java.awt.*;
import Raster;
import Sprite;

class Playfield extends Raster {
  public Raster background;          // background image
  public Sprite sprites[];    // list of sprites on this playfield
  
  public Playfield(Image bgnd, int numSprites)
  {
    super(bgnd);
    background = new Raster(bgnd);
    sprites = new Sprite[numSprites];
  }
  
  public void addSprite(int i, Sprite s) 
  {
    sprites[i] = s;
  }
  
  public void Draw( )
  {
    int i,x,y;
    // draw the background
    for(y=0;y<background.height;y++)
      {
	for(x=0;x<background.width;x++)
	  {
	    setPixel(background.getPixel(x,y), x, y);
	  }
      }
    // draw the sprites, first to last.
    for (i=0; i<sprites.length; i++) {
      sprites[i].Draw(this);
    }
  }
}

