# Delete one shape and add another or moving shapes

**URL:** <https://discourse.processing.org/t/delete-one-shape-and-add-another-or-moving-shapes/7503>\
**Category:** Coding Questions\
**Created:** [January 14, 2019, 1:02pm UTC](https://discourse.processing.org/t/delete-one-shape-and-add-another-or-moving-shapes/7503 "2019-01-14T13:02:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mizu](https://avatars.discourse-cdn.com/v4/letter/m/b9e5f3/32.png) [@mizu](https://discourse.processing.org/u/mizu)\
**Post date:** [January 14, 2019, 1:02pm UTC](https://discourse.processing.org/t/delete-one-shape-and-add-another-or-moving-shapes/7503/1 "2019-01-14T13:02:56Z")

</div>

```auto
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?

---

<div class="post-metadata">

**Author:** ![Sky](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sky/32/3013_2.png) [@Sky](https://discourse.processing.org/u/Sky)\
**Post date:** [January 14, 2019, 6:05pm UTC](https://discourse.processing.org/t/delete-one-shape-and-add-another-or-moving-shapes/7503/2 "2019-01-14T18:05:23Z")

</div>

> [@mizu](#):
>
> ellipse(mouseX,mouseY,15,15);

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

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

```

---

<div class="post-metadata">

**Author:** ![mizu](https://avatars.discourse-cdn.com/v4/letter/m/b9e5f3/32.png) [@mizu](https://discourse.processing.org/u/mizu)\
**Post date:** [January 14, 2019, 11:26pm UTC](https://discourse.processing.org/t/delete-one-shape-and-add-another-or-moving-shapes/7503/3 "2019-01-14T23:26:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mizu](https://avatars.discourse-cdn.com/v4/letter/m/b9e5f3/32.png) [@mizu](https://discourse.processing.org/u/mizu)\
**Post date:** [January 15, 2019, 3:01am UTC](https://discourse.processing.org/t/delete-one-shape-and-add-another-or-moving-shapes/7503/4 "2019-01-15T03:01:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Sky](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sky/32/3013_2.png) [@Sky](https://discourse.processing.org/u/Sky)\
**Post date:** [January 15, 2019, 12:47pm UTC](https://discourse.processing.org/t/delete-one-shape-and-add-another-or-moving-shapes/7503/5 "2019-01-15T12:47:08Z")

</div>

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