void setup(){
size (400, 400);
}
void draw() {
background(100);
smooth();
ballx += speed;
if (ballx > width) {
speed = speed * -1;
}
ellipse (ballx, bally, 20, 20);
}
void setup(){
size (400, 400);
}
void draw() {
smooth();
background(100);
if (((mouseX > boxX - ballsize/2) && (mouseX < boxX + boxwidth + ballsize/2)) && ((mouseY > boxY - ballsize/2) && (mouseY < boxY + boxheight + ballsize/2))){
fill(250, 0, 0);
}
else{
fill(250, 250, 250);
}
rect (boxX, boxY, boxwidth, boxheight);
ellipse (mouseX, mouseY, ballsize, ballsize);
}
void setup(){
size (400, 400);
}
void draw() {
smooth();
float distance = dist( ballx, bally, mouseX, mouseY);
if (distance > ballsize/2 + ballsize2/2){
background(250, 0, 0);
}
else
{
background(0, 250, 0);
}
ellipse (mouseX, mouseY, ballsize, ballsize);
ellipse (ballx, bally, ballsize2, ballsize2);
}