# My Pictures disapear when using other commands

**URL:** <https://discourse.processing.org/t/my-pictures-disapear-when-using-other-commands/36996>\
**Category:** Coding Questions\
**Tags:** homework\
**Created:** [May 21, 2022, 1:30pm UTC](https://discourse.processing.org/t/my-pictures-disapear-when-using-other-commands/36996 "2022-05-21T13:30:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Katharina](https://avatars.discourse-cdn.com/v4/letter/k/7993a0/32.png) [@Katharina](https://discourse.processing.org/u/Katharina)\
**Post date:** [May 21, 2022, 1:30pm UTC](https://discourse.processing.org/t/my-pictures-disapear-when-using-other-commands/36996/1 "2022-05-21T13:30:45Z")

</div>

Before giving the Problem + code let me tell you my Programm.  
Im trying to create a dress up game for my schoolwork.  
You click on a bar and the game starts.  
I’ve created 3 lines of arrows (pfeil) for that: \<–(left) and --\>(right) using for loops.(but that’s not imporant)  
My goal for now is that when I click on the right arrow in the first row the body color changes. I’ve created an array full of pictures for that named haut. I got help for that but when I coded that if mousePressed the body should change, the pictures(arrows) disappear. I suspect it has to do something with redraw() but I don’t know how to fix that. In the code I only marked things grey which things are important for the Problem so you won’t get confused.

!!The Problem is at the bottom of the code!!

THE CODE:

> //THE ARROWS VARIABLES (NOT IMPORTANT)  
> PImage pfeilRechts1Reihe;  
> PImage pfeilLinks1Reihe;  
> PImage pfeilRechts2Reihe;  
> PImage pfeilLinks2Reihe;  
> PImage pfeilRechts3Reihe;  
> PImage pfeilLinks3Reihe;  
> PImage pfeilRechts4Reihe;  
> PImage pfeilLinks4Reihe;  
> int pU= 35; //Umfang Pfeil  
> int posYErsteReihe= 230;  
> int posYZweiteReihe= 340;  
> int posYDritteReihe= 450;  
> int posYVierteReihe= 550;  
> int posXRechts1=80;  
> int posXLinks1=45;  
> int posXRechts2=80;  
> int posXLinks2=45;  
> int pfeil;  
> int pfeil2;  
> int hautzaehler=0; //VARIABLE FOR THE SKIN(IMPORTANT)  
> PImage base;  
> PImage haut1;  
> PImage haut2;  
> PImage haut3;  
> PImage haut4;  
> PImage haut; //ARRAY FOR THE SKIN  
> void setup() { //JUST LOADING IMAGES(NOT IMPORTANT  
> size(800, 600);  
> menu= loadImage(“AuswahlMenu.png”);  
> pfeilLinks1Reihe= loadImage(“PfeilLinks.png”);// Pfeile\<  
> pfeilRechts1Reihe= loadImage(“PfeilRechts.png”);  
> pfeilLinks2Reihe= loadImage(“PfeilLinks.png”);  
> pfeilRechts2Reihe= loadImage(“PfeilRechts.png”);  
> pfeilLinks3Reihe= loadImage(“PfeilLinks.png”);  
> pfeilRechts3Reihe= loadImage(“PfeilRechts.png”);  
> pfeilLinks4Reihe= loadImage(“PfeilLinks.png”);  
> pfeilRechts4Reihe= loadImage(“PfeilRechts.png”);// \>Pfeile  
> startBildschirm= loadImage(“StartBildschirm.png”);  
> clickbarStartbildschirm= loadImage(“ClickbarStartbildschirm.png”);  
> clickToStartText= loadImage(“ClickToStartText.png”);  
> titel= loadImage(“Titel.png”);  
> haut= new PImage[5]; //THE ARRAY(IMPORTANT)  
> haut[0]= loadImage(“Base.png”);  
> haut[1]= loadImage(“Haut1.png”);  
> haut[2]= loadImage(“Haut2.png”);  
> haut[3]= loadImage(“Haut3.png”);  
> haut[4]= loadImage(“Haut4.png”);  
> }  
> void draw() { ///CODING THE STARTSCREEN(NOT IMPORTANT)  
> if(start==false){  
> imageMode(CENTER);  
> image(startBildschirm,width/2,height/2,width,height);  
> image(titel,405,350,700,700);  
> rect(250,350,300,100);  
> image(clickToStartText,405,310,650,600);  
> starten();  
> }  
> if (start==true){  
> //Hintergrund fehlt  
> imageMode(CORNER);  
> mage(haut[hautzaehler],280,00,600,600); //THE BODY(IMPORTANT)  
> image(menu,0,0,800,600);//Menü  
> pfeileErstellen1Und2Reihe();  
> pfeileErstellen3Reihe();  
> }  
> }  
> //PLACING THE ARROWS WHICH DISAPPEAR (SOMEWHAT IMPORTANT)  
> void pfeileErstellen1Und2Reihe(){ //function 1 and 2 row  
> for(int i= 0; pfeil\<5; pfeil++){//Pfeil ++ damit es sich nur einmal wiederholt  
> imageMode(CENTER);  
> image(pfeilLinks1Reihe, posXLinks1, posYErsteReihe, pU, pU);  
> image(pfeilRechts1Reihe, posXRechts1, posYErsteReihe, pU, pU);  
> image(pfeilLinks2Reihe, posXLinks1, posYZweiteReihe, pU, pU);  
> image(pfeilRechts2Reihe, posXRechts1, posYZweiteReihe, pU, pU);  
> image(pfeilLinks3Reihe, posXLinks1, posYDritteReihe, pU, pU);  
> image(pfeilRechts3Reihe, posXRechts1, posYDritteReihe, pU, pU);  
> posXRechts1+=75;  
> posXLinks1+=75;  
> noLoop(); //So the loop won’t repeat itself and only the necessary arrows appear  
> }  
> }  
> void pfeileErstellen3Reihe(){ //function 3 row  
> for(int i= 0; pfeil2\<3; pfeil2++){//Pfeil ++ damit es sich nur einmal wiederholt  
> imageMode(CENTER);  
> image(pfeilRechts4Reihe, posXRechts2, posYVierteReihe, pU, pU);  
> image(pfeilLinks4Reihe, posXLinks2 ,posYVierteReihe, pU, pU);  
> posXRechts2+=75;  
> posXLinks2+=75;  
> noLoop();  
> }  
> }  
> //HERE’S THE PROBLEM:  
> void mousePressed(){  
> if(dist (mouseX,mouseY, 45,230) \<35){ //arrow position  
> hautzaehler= (hautzaehler +1) % haut.length;  
> redraw();  
> }  
> }

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [May 24, 2022, 1:31am UTC](https://discourse.processing.org/t/my-pictures-disapear-when-using-other-commands/36996/2 "2022-05-24T01:31:37Z")

</div>

Hi

Are you both in the same class ☺☺

> [@My pictures in array don't disappear, they overlap](https://discourse.processing.org/t/my-pictures-in-array-dont-disappear-they-overlap/37020/1):
>
> so I made a programm. I dress up game to be excact. I’ve programmed it but there’s one problem: The pictures I use in arrays,when executed only overlap themselves not disappear. Meaning when I click the button “blush” or “Gesicht” the blush or face from the previous option can still be seen. How do I programm it that when I click the button the picture disappears and another picture comes? The coding for that is at the botton of the code at: void mousePressed(){} [grafik] boolean start= f…

---

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [May 24, 2022, 1:34am UTC](https://discourse.processing.org/t/my-pictures-disapear-when-using-other-commands/36996/3 "2022-05-24T01:34:23Z")

</div>

Hi again

Sorry I did not read the names 😃

---

<div class="post-metadata">

**Author:** ![Katharina](https://avatars.discourse-cdn.com/v4/letter/k/7993a0/32.png) [@Katharina](https://discourse.processing.org/u/Katharina)\
**Post date:** [May 26, 2022, 11:46am UTC](https://discourse.processing.org/t/my-pictures-disapear-when-using-other-commands/36996/4 "2022-05-26T11:46:46Z")

</div>

We? I just asked multiple questions. That question is also me 😆
