Having Problems with simple Conditional.
in
Programming Questions
•
2 years ago
I am a real noobie at programming, so don't kill me for this.
I am trying to make a simple game where you click expanding bubbles and they disappear. I am having trouble with writing a conditional where the condition is that the 1) the mouse has to be pressed and 2) it has to be within the bubble.
void setup(){
size(400,400);
background(255);
}
int a=50;
int b=50;
int i=0;
int score=0;
void draw(){
if(i<80){
ellipse(a,b,i,i);
fill(255,150,150);
i++;
}else if(i==80){
i++;
}else if(i==81){
a=(int)random(0,400);
b=(int)random(0,400);
i=0;
background(255);
}
//this one
if(mousePressed && (a-i)<mouseX<(a+i)==true && (b-i)<mouseY<(b+i))==true{
background(255);
}
}
1