import java.awt.*;
import java.awt.image.ImageObserver;

public class Sprite extends Raster
{
	public int x, y;	// upper-left corner of sprite on playfield
	public int bgndcolor;	
	public Sprite()
	{
	}
	
	public Sprite(Image image)
	{
		super(image);
		System.out.println(pixel[0]);
		bgndcolor=pixel[0];
		x=0;
		y=0;
	}
	
	public void Draw(Raster bgnd) // pass in current copy of background, sprite draws onto it
	{
		for (int i=0; i<width; i++)
			for (int j=0; j<height; j++)
			{
				if (i+x>=0 && j+y>=0 && i+x<=bgnd.width && j+y<=bgnd.height)
					if (getPixel(i, j) != bgndcolor)
					{
						bgnd.setPixel(getPixel(i, j), i+x, j+y);
					}
			}
	}
}
