Delete one shape and add another or moving shapes

float radius;
void setup() {
  size(1440, 900);
}

int clicks=0;
int screen = 0;
float counter;
void draw() {
  float l= random(1380);
  float r= random(640);

  if (clicks==clicks+1)
    background(0);


  radius=30;
  println(mouseX, mouseY);
  background(0);
  if (screen ==0) {
    textAlign(CENTER, CENTER);
    fill(255, 255, 255);
    textSize(30);
    text("Click to Start", 720, 450);
    if (mousePressed) {
      screen = 1;
      counter = 0;
    }
  }
  if (screen == 1) {
    noCursor();
    fill(127, 255, 212);
    ellipse(mouseX, mouseY, 15, 15);
    counter = counter+0.0183;
    textAlign(CENTER, CENTER);
    fill(255, 255, 255);
    textSize(20);
    text(clicks, 720, 812);
    textSize(30);
    fill(255, 255, 255);
    text(counter, 720, 700);
    textSize(25);

    text("Press Any Key to Restart", 720, 756);
    fill(255, 105, 180);
    ellipse(l, r, 60, 60);

    if (counter > 60) {
      screen = 2;
    }
    if (keyPressed) {
      screen = 0;
    }
  }
  if (screen == 2) {
    background(102, 0, 204);
    fill(255, 105, 180);
    ellipse(720, 450, 500, 500);
    textAlign(CENTER, CENTER);
    fill(255, 255, 255);
    textSize(30);
    text(clicks, 720, 500);
    textSize(30);
    fill(255, 255, 255);
    text("Your Score", 720, 400);
    int score = clicks/60;
    text("Cirlces Per Second:", 720, 550);
    text(score, 880, 550);


    textSize(25);
    text("Press Any Key to Restart", 720, 600);
  }
  if (keyPressed) {
    screen = 0;
  }
}

float l= random(1380);
float r= random(640);


void mouseReleased() {     
  if (dist(mouseX, mouseY, l, r)<radius) {
    clicks++;
  }
}

My code makes a circle that if you click it you will get one point. How do i make it so when i click the circle it disappears and makes a new one?

1 Like

you should create an X var and Y var for ellpse() position

if(mousePressed){
X = mouseX;
Y = mouseY;
}
.......
ellipse(X,Y,15,15)
1 Like

the this ellipse(l,r,60,60); is the one i want to disappear when i click it and appear somewhere else.

i could move it to another position instead of getting rid of it but i dont know how

if the mouse touched the circle, l = random() r = random(), score ++