Making a game: maybe problems with dist()?
in
Programming Questions
•
2 years ago
I am making a simple game where you pop bubbles as a mouse for a little beginners project.
When I try to run it I get an error saying "unexpected token: {". I highlights the code I have made yellow below. Why is this, and more importantly, how can I fix it?
void setup(){
size(400,400);
background(255);
}
// X and Y coordinates for center of Bubble
int a=50;
int b=50;
//Counter for "for" statement
int i=0;
//Score, not implemented yet
int score=0;
void draw(){
//Click to pop the bubble
if((dist(a,b,mouseX,mouseY) == dist(a,b,i,i) && mousePressed){
background(255);
}
//This draw the circles
if(i<80){
ellipse(a,b,i,i);
fill(255,150,150);
i++;
}else if(i==80){
a=(int)random(0,400);
b=(int)random(0,400);
i=0;
background(255);
}
}
1