# Unclick and it goes back as it started -- a beginner needs help

**URL:** <https://discourse.processing.org/t/unclick-and-it-goes-back-as-it-started-a-beginner-needs-help/10448>\
**Category:** Coding Questions\
**Created:** [April 19, 2019, 4:09am UTC](https://discourse.processing.org/t/unclick-and-it-goes-back-as-it-started-a-beginner-needs-help/10448 "2019-04-19T04:09:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dianap](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@dianap](https://discourse.processing.org/u/dianap)\
**Post date:** [April 19, 2019, 4:09am UTC](https://discourse.processing.org/t/unclick-and-it-goes-back-as-it-started-a-beginner-needs-help/10448/1 "2019-04-19T04:09:43Z")

</div>

I´ve literally been an hour into Processing and I´ve made this

```auto
void setup(){
  size(500,400);
background(#FA9E8D);}
void draw(){
  stroke(#FAD5BD);
fill(#FAD5BD);
ellipse(250, 200, 350, 350);
stroke(#FA5D5D);
fill(#FA5D5D);
rect(170, 250, 180, 20);
stroke(#5A100E);
fill(#5A100E);
ellipse(180, 130, 120, 120);
ellipse(320, 130, 120, 120);
if(mousePressed){
  background(#F559E3);
stroke(#4DEAF7);
fill(#4DEAF7);
ellipse(250, 200, 350, 350);
stroke(#AD77FA);
fill(#AD77FA);
rect(150, 200, 180, 100);
stroke(#95FA77);
fill(#95FA77);
ellipse(150, 100, 120, 120);
ellipse(300, 100, 120, 120);
  stroke(#FFFFFF);
fill(#FFFFFF);
rect(150, 200, 30, 30);
rect(200, 200, 30, 30);
rect(250, 200, 30, 30);
rect(300, 200, 30, 30);
rect(150, 270, 30, 30);
rect(200, 270, 30, 30);
rect(250, 270, 30, 30);
rect(300, 270, 30, 30);
ellipse(150, 100, 60, 60);
ellipse(300, 100, 60, 60);
}
}

```

the thing is, when you click, it´s all good, but I don´t know how to quit the remaining part of the green circle and also to go back to the peachy background, like, click it and the other face shows up, unclick and it goes back as it started, but I don´t know what do I have to change

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [April 19, 2019, 4:43am UTC](https://discourse.processing.org/t/unclick-and-it-goes-back-as-it-started-a-beginner-needs-help/10448/2 "2019-04-19T04:43:53Z")

</div>

> [@dianap](#):
>
> background(#FA9E8D);

if you move that from setup to ( first line in ) draw it might look like you wanted?

but pls. take some comments to your first post here:  
-a- posting code:  
you edit your code in processing IDE ( now ver. 3.5.3 )  
and press [ctrl][t] to format it there ( and pls. save it )

you edit above post here at the forum and delete that code part.

now press

```auto
</> code format

```

and paste your code inside

-b- to understand / test / and discuss code here it does not need  
– 100 circles / rectangles  
– big formats like canvas(5000,5000) or fullscreen

something small but pointing out the program flow  
and indicating where the errors might be.

* * *

for you program flow i would say you take also a look at

> **[mousePressed() / Reference](https://processing.org/reference/mousePressed_.html)**
>
> The mousePressed() function is called once after every time a mouse button is pressed. The mouseButton variable (see the related reference entry) can be used to determine which button ha…

so idea is to have that outside of draw()…  
set some variables ( in case of click )  
and use that variables in draw()

```auto
boolean mousetoggle = false;
void setup(){}
void draw() {
 if ( mousetoggle ) {
   background(200,200,0);
 } else {
   background( 0,0,80);
 }
}

void mousePressed() {
  mousetoggle = ! mousetoggle;
}

```

play with it

---

<div class="post-metadata">

**Author:** ![janglee](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/janglee/32/4035_2.png) [@janglee](https://discourse.processing.org/u/janglee)\
**Post date:** [April 19, 2019, 4:44am UTC](https://discourse.processing.org/t/unclick-and-it-goes-back-as-it-started-a-beginner-needs-help/10448/3 "2019-04-19T04:44:17Z")

</div>

Hey, @dianap it is nice that you shared your problem. But help us to help you, write your code inside \</\> tag.

---

<div class="post-metadata">

**Author:** ![dianap](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@dianap](https://discourse.processing.org/u/dianap)\
**Post date:** [April 19, 2019, 5:11am UTC](https://discourse.processing.org/t/unclick-and-it-goes-back-as-it-started-a-beginner-needs-help/10448/4 "2019-04-19T05:11:13Z")

</div>

wow, thank you so much for your help!
