# Add another shape with each mouse click! Help!

**URL:** https://discourse.processing.org/t/add-another-shape-with-each-mouse-click-help/4033
**Category:** Beginners
**Created:** [October 2, 2018, 4:41am UTC](https://discourse.processing.org/t/add-another-shape-with-each-mouse-click-help/4033 "2018-10-02T04:41:54Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![madiMcD](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@madiMcD](https://discourse.processing.org/u/madiMcD)
#### Post date: [October 2, 2018, 4:41am UTC](https://discourse.processing.org/t/add-another-shape-with-each-mouse-click-help/4033/1 "2018-10-02T04:41:54Z")

</div>

Hi!

I am just starting out with coding and I have to create a simple program in code that accomplishes the following guidelines:  
“Count the number of mouse presses in the canvas and use that to change the number of  
shapes drawn for each frame such that more mouse presses means more shapes.”

this is what I have so far:

```auto
int numberOfPresses = 0;
PShape square;

void setup(){
  size(300, 300);
  square = createShape(RECT, random(300), random(300), 30, 30);
}

void mousePressed(){
  numberOfPresses = numberOfPresses + 1;
  println("ShapeCount: " + numberOfPresses);
}

void draw(){
  shape(square);
}

```

I am able to count my mouse clicks, and create a random square within the space, however, I can’t figure out how to keep adding randomly placed squares with each new mouse click.  
Any help would be greatly appreciated!!

---

<div class="post-metadata">

### Author: ![jb4x](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jb4x/32/789_2.png) [@jb4x](https://discourse.processing.org/u/jb4x)
#### Post date: [October 2, 2018, 5:57am UTC](https://discourse.processing.org/t/add-another-shape-with-each-mouse-click-help/4033/2 "2018-10-02T05:57:21Z")

</div>

Hi madeMcD,

You should have a look at the [for loop](https://processing.org/reference/for.html) structure. That’s how you’ll manage to draw several shape based on the number of mouse clicks.
