
import objectdraw.*;
import java.awt.*;

/*
 * A program that lets the user dribble only
 * one basketball at a time.
 */
public class DribbleController extends WindowController {
    
    private BBall greenBall, purpleBall;
    
    private Dribbler dribbler;
    
    // display the shirts
    public void begin() {
        greenBall = new BBall(100,250,35,canvas);
        greenBall.setColor(Color.green);

        purpleBall = new BBall(300,250,35,canvas);
        purpleBall.setColor(new Color(200,0,200));
   }
    
    public void onMouseClick(Location point) {
        // create a new dribbler if there is not current dribbler
        // or the current dribbler is no longer dribbling.
        if (dribbler == null || !dribbler.isDribbling()) {
            if (greenBall.contains(point)) {
                dribbler = new Dribbler(greenBall);
            } else if (purpleBall.contains(point)) {
                dribbler = new Dribbler(purpleBall);
            } 
        }
    }
}
