xxxxxxxxxx
int x;
int y;
int buttonwidth;
int buttonheight;
//ellipse
int xx;
int yy;
int zz;
int speed;
boolean ball = false;
void setup () {
size (500, 300);
x = width/3;
y = height /3;
xx = 200;
yy = 120;
zz = -30;
speed = 4;
buttonwidth = 50;
buttonheight = 40;
}
void draw () {
background (0, 255, 255);
ellipse (xx, yy, zz, zz);
fill (255, 0 ,0 );
rect (x, y, buttonwidth, buttonheight);
if (ball == true) {
xx = xx+speed;
} else {
}
if (ball == true) {
fill (#ffffff);
rect (x , y, buttonwidth, buttonheight);
}
}
void mouseClicked () {
if ((mouseX > x) &&
(mouseX < (x + buttonwidth)) &&
(mouseY > y) &&
(mouseY < (y + buttonheight))) {
} if (ball == true) {
ball = false; }
else {
ball = true;
}
}