Simple Circle Game
in
Programming Questions
•
1 year ago
Hey everyone,
I asked a question earlier about how to expand a circle with a mouse click and got very helpful answers. I have another question about how I can get the circle that is expanding to stop when I release my mouse button. I figure I will have to use void mouseReleased () but I want the circle to stay the shape it has expanded to, not return to a small dot.
My code so far is as follows:
int a = 0;
void setup() {
size(500,500);
smooth();
}
void draw() {
fill(255);
ellipse(250,250,300,300);
a++;
fill(0);
ellipse(width/2, height/2,a,a);
if (a>width) {
a=0;
}
if (mousePressed ==true) {
a = a++;
}else{
a=0;
}
}
//void mouseReleased() {
//if(a==0) {
//a=a++;
// }else{
//a=0;
//}
//}
Any advice would be greatly appreciated,
Thanks
1