Hi this is my code the code should work like after clicking the new spawned cirlce another one should apear and after cliking the new one another one should spawn but it has some problem , for example i dont know what type of logic i should write for it? should i write recursion if yes then how?
float xpaikka =random(640);
float ypaikka =random(640) ;
int value_y = 0 ;
int value_x = 0 ;
void setup(){
size(640,640);
frameRate(500);
background(34,45,323);
}
void draw(){
ellipse(xpaikka,ypaikka,60,60);
float randomi_x = random(630);
float randomi_y = random(630);
var d= dist(mouseX,mouseY,randomi_x,ypaikka);
if (d < 30 && value_x != 0){
ellipse(randomi_x,randomi_y,60,60);
value_x = 0;
}
}
void mousePressed() {
if (value_x == 0) {
value_x = mouseX;
print("mouseX",value_x);
} else {
value_x = 0;
}
}
void mousePressed2() {
if (value_y == 0) {
value_y = mouseY;
print("mouseY",mouseY);
} else {
value_y = 0;
}
}
