//Jason Martin //Project 9 float buttonX = 15; float buttonQ = 230; int table = 0; Ball[] martin = new Ball [5]; Button[] jason = new Button [5]; void setup() { size (800,600); martin[0]= new Ball(255,0,0); martin[0].y = 100; martin[1]= new Ball(0,255,0); martin[1].y = 200; martin[2]= new Ball(0,191,255); martin[2].y = 300; martin[3]= new Ball(40,40,40); martin[3].y = 400; martin[4]= new Ball(255,255,255); martin[4].y = 500; jason[0] = new Button(buttonX,height-30,70,30,"Red"); jason[1] = new Button(buttonX+buttonQ*.75,height-30,70,30,"Green"); jason[2] = new Button(buttonX+buttonQ*1.5,height-30,70,30,"Bloo"); jason[3] = new Button(buttonX+buttonQ*2.25,height-30,70,30,"Tablé"); jason[4] = new Button(buttonX+buttonQ*3,height-30,70,30,"What?"); } void draw() { noStroke(); background(139,69,19); if(table%2==0){ fill(5,25,255); rect(50,50,700,500); noStroke(); fill(0); ellipse(73,73,45,45); ellipse(389,73,45,45); ellipse(727,73,45,45); ellipse(389,527,45,45); ellipse(73,527,45,45); ellipse(727,527,45,45); } else{ fill(0); rect(50,50,700,500); noStroke(); fill(255); ellipse(72,72,45,45); ellipse(390,72,45,45); ellipse(728,72,45,45); ellipse(390,528,45,45); ellipse(72,528,45,45); ellipse(728,528,45,45); } spinBalls(); makebuttonQ(); } void mousePressed(){ if(jason[0].mouseOn()){ redReset(); } if(jason[1].mouseOn()){ greenReset(); } if(jason[2].mouseOn()){ blueReset(); } if(jason[3].mouseOn()){ table+=1; } if(jason[4].mouseOn()){ exit(); } } void keyPressed(){ if(key == '1'){redReset();} if(key == '2'){greenReset();} if(key == '3'){blueReset();} if(key == 'q') exit(); } void makebuttonQ(){ for(int draw=0;drawwidth-65) mX=-mX; x += mX; if (y<60||y>height-65) mY=-mY; y += mY; if(mY==0 ){mY=3;} } void make() { noStroke(); fill(r,g,b); ellipseMode(CENTER); ellipse(x,y,w,h); } } class Button { float x,y,w,h; String text; Button(float x,float y,float w,float h,String text){ this.x=x; this.y=y; this.w=w; this.h=h; this.text=text; } void draw(){ fill(255,0,255); rect(x,y,w,h,0); fill(0); text(text,x+h/3,y+w/3); } boolean mouseOn(){ if(mouseX>x&&mouseXy&&mouseY