////Bomball in Processing Version One by Aaron Graham Button leftright = new Button(); Batter batter = new Batter(); Ball ball = new Ball(); void setup(){ ////Setup dimensions of screen size(800,600); } void draw(){ //// Frame scene(); score(); ball.move(); ball.show(); batter.move(); batter.show(); check(); } void mousePressed(){ ////When mouse is pressed, do this //Having trouble with curly brackets if(leftright.hit(mouseX,mouseY)) if(swing.hit(mouseX,mouseY)) swinging=true; else swinging = false; } class Button { //// Button, including hit(x,y) method // Properties //Should x and y and s be defines? float d = 50.0; float x=2; float y=1; float w=100; float h=50; int r=50; int g=150; int b=75; string name; //// Constructors Button(float x, float y, string s) { this.x=x; this.y=y; this.name=s; } ////Methods//// void show(){ // fill(r,g,b); rectMode(CENTER); rect(x,y,w,h); fill(0); text(name,x-w/2+10,y-5); } boolean hit(float xx,float yy){ return(xx > x-w/2 && xx < x+w/2 && yy > y-w/2 && yy < y+w/2); } void check(){ //// check collisions and action //Why can't d or any whole or decimal number be a' //registered token? if(swinging){ if(dist(batter.x,batter.y,ball.x,ball.y)<= 10 { ////Button has hit ball score = 10 ball.dx=5 ball.dy=5 swinging=false } else if (ball.y > batter.y-800 ////Missed swinging = false } }