package breakout;

import cs101.awt.*;
import cs101.io.*;
import cs101.lang.*;
import java.awt.Point;
import java.awt.Color;
import java.awt.Graphics;

public class MultiBall extends ClassicBall
{
	private ScreenCanvas screen;
	private BrickRepository brickrepos;
	private BallRepository ballrepos;
	private Point center;
	private double radius=6.0, xVel, yVel;
	private AnimatorThread anim;
	protected int ballIndex;
	
	public MultiBall (ScreenCanvas sc, BrickRepository brickrepos, 
						BallRepository ballrepos, BreakOutBall boball)
	{
		super(sc, brickrepos, ballrepos);
		
		this.screen = sc;
		this.brickrepos = brickrepos;
		this.ballrepos = ballrepos;
		if (boball instanceof ClassicBall) {
			this.center = new Point ( ((ClassicBall)boball).center.x, ((ClassicBall)boball).center.y);
			this.xVel = ((ClassicBall)boball).xVel;
			this.yVel = ((ClassicBall)boball).yVel;
		}
		else if (boball instanceof MultiBall) {
			this.center = new Point ( ((MultiBall)boball).center.x, ((MultiBall)boball).center.y);
			this.xVel = ((MultiBall)boball).xVel;
			this.yVel = ((MultiBall)boball).yVel;
		}
		
		
		if (this.xVel < 0) {
			this.xVel =  -((Math.random()) * 5);
		}
		if (this.yVel < 0) {
			this.yVel = -( (Math.random()) * 5);
		}
		else {
			this.xVel = (Math.random()) * 5;
			this.yVel = (Math.random()) * 5;
		}
	}
	
}
