import java.awt.*;
import java.awt.image.*;
import java.util.Vector;

// Very simplified AnimateSprite that just takes in more than one image
class AnimatedSprite extends MovingSprite
{
	int frames;         // frames in sprite
	Sprite sprite[];    // list of sprites in this animated sprite	
	int nNumState, nCurState;
	
	// Create an animated sprite with firstImage as the first image
	//		and frames as the number of frames.
	//		1 frames means that there will be no more images
	public AnimatedSprite(Image firstImage, int frames)
	{
		super(firstImage);
		sprite = new Sprite[frames];
		nNumState = 1;
		nCurState = 0;
	}
	
	public AnimatedSprite(Image firstImage, int frames, boolean bValue)
	{
		super(firstImage, bValue);
		sprite = new Sprite[frames];
		nNumState = 1;
		nCurState = 0;
	}

	public AnimatedSprite(Image firstImage)
	{
		this(firstImage, 1);
	}
	
	public AnimatedSprite(Image firstImage, boolean bValue)
	{
		this(firstImage, 1, bValue);
	}

	public void addSprite(int i, Sprite s)
	{
		sprite[i] = s;
		nNumState++;
	}

	public void draw(MyRaster bgnd)
	{
		if (nCurState==0)
			super.draw(bgnd);
		else
		{
			sprite[nCurState].setPosition(getXPosition(), getYPosition());
			sprite[nCurState].draw(bgnd);
		}
	}
	
	public void nextState()
	{
		super.nextState();
	}
	
	public void nextFrame()
	{
		nCurState++;
		if (nCurState>=nNumState)
			nCurState = 0;
	}
}