// *********************************************************************
// Fireworks.java
// This object represents a simple fireworks display that draws itself
// on the specified graphics context.
//
// Murphy Stein
// NYU Computer Graphics
// 2006
// *********************************************************************
import java.awt.*;

public class Fireworks
{

	int x, y;
	Ball BallArray[];
	Color c;
	
	static int NUM_BALLS = 100;
	
	// ** Constructor ** //
	// Create NUM_BALLS or sparks at x, y
	// Assign them all the same color so they look pretty
	public Fireworks(int x, int y) {
		this.x = x;
		this.y = y;
		BallArray = new Ball[NUM_BALLS];	
		c = new Color((float)Math.random(),(float)Math.random(),(float)Math.random());
		for (int i = 0; i < NUM_BALLS; i++) {
			BallArray[i] = new Ball( x, y, 0, c );
		}

	}

	// Draw all of the sparks one at a time
	public void draw(Graphics g) {
		for (int i = 0; i < NUM_BALLS; i++) {
				BallArray[i].draw(g);
				BallArray[i].move();
		}
	}
	
}