# Syntax error even though there is none

**URL:** https://discourse.processing.org/t/syntax-error-even-though-there-is-none/40417
**Category:** Beginners
**Created:** [January 2, 2023, 8:01pm UTC](https://discourse.processing.org/t/syntax-error-even-though-there-is-none/40417 "2023-01-02T20:01:55Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![iinnessic](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@iinnessic](https://discourse.processing.org/u/iinnessic)
#### Post date: [January 2, 2023, 8:01pm UTC](https://discourse.processing.org/t/syntax-error-even-though-there-is-none/40417/1 "2023-01-02T20:01:55Z")

</div>

My console says there is a synthax error even though i am pretty sure there is none…

void mousePressed () {  
Variante = int ( random (1,6));  
}

---

<div class="post-metadata">

### Author: ![debxyz](https://avatars.discourse-cdn.com/v4/letter/d/58956e/32.png) [@debxyz](https://discourse.processing.org/u/debxyz)
#### Post date: [January 2, 2023, 8:20pm UTC](https://discourse.processing.org/t/syntax-error-even-though-there-is-none/40417/2 "2023-01-02T20:20:03Z")

</div>

Hello @iinnessic

> [@iinnessic](#):
>
> Variante = int ( random (1,6));

Did you try?

`int variante = int(random(1,6));`

🤓

---

<div class="post-metadata">

### Author: ![iinnessic](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@iinnessic](https://discourse.processing.org/u/iinnessic)
#### Post date: [January 2, 2023, 8:22pm UTC](https://discourse.processing.org/t/syntax-error-even-though-there-is-none/40417/3 "2023-01-02T20:22:12Z")

</div>

I just did, doesnt change anything… ☹

---

<div class="post-metadata">

### Author: ![javagar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/javagar/32/11434_2.png) [@javagar](https://discourse.processing.org/u/javagar)
#### Post date: [January 2, 2023, 8:37pm UTC](https://discourse.processing.org/t/syntax-error-even-though-there-is-none/40417/4 "2023-01-02T20:37:01Z")

</div>

Please let us see several lines of code that immediately precede the ones that you posted.

---

<div class="post-metadata">

### Author: ![iinnessic](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@iinnessic](https://discourse.processing.org/u/iinnessic)
#### Post date: [January 2, 2023, 8:38pm UTC](https://discourse.processing.org/t/syntax-error-even-though-there-is-none/40417/5 "2023-01-02T20:38:30Z")

</div>

The line i posted is in a separate tab of the following sketch:

// Gloable Variablen

// Button QUiz starten  
int rectColor = #BECBDB;

// Farbe REechtecke A, B und C  
boolean ButtonA = false;  
boolean ButtonB = false;  
boolean ButtonC = false;  
int rectA;  
int rectB;  
int rectC;  
int rectEnter;

int newSiteColor; // “neues” Fenster  
int textColor; // Schriftfarbe  
int bkColor; // hintergrundfarbe

// Bilder  
PImage img1;  
PImage img2;  
PImage img3;

// wichtig für random funkton  
boolean Bild1A = false;  
boolean Bild1B = false;  
boolean Bild1C = false;  
boolean Bild2A = false;  
boolean Bild2B = false;  
boolean Bild2C = false;  
boolean Bild3A = false;  
boolean Bild3B = false;  
boolean Bild3C = false;

// wichtig für Random Funktion  
int Variante;

// Helvetica einsetzen  
PFont font;

// Enter shortcut

```
void setup () { 

  size (1000, 800);  
  bkColor = #DAD4CB; 
  background (bkColor);
  font = loadFont("Helvetica.vlw");
} 

void draw () { 

  // QUiz Button
    rectMode(CENTER); 
    fill (rectColor); 
    rect ( 500, 720, 100, 60); 

 
 hoverEffekt(); // hover Effekt 

// __________________________________________ 

 textFunktion(); // Funktionsaufruf 

```

//\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
keyPressed(); // Funktionsaufruf  
//\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
mouseClicked (); // Funktionsaufruf  
//\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
mousePressed(); // Funktionsaufruf  
//\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_

```
// Wenn hintergrund weiß ist, dann folgende Code ausführen:
  if (bkColor == #BECBDB){ 

// erstellt eine "neue" Seite   
  newSiteColor = #DAD4CB;    
  fill (newSiteColor); 
  rect(0,0,100000,8000); 

  
// Aufgabenstellung
  textSize(30); 
  fill(0); 
  text("Welche Darstellung entspricht", 500, 150); 
  text("dem Gestaltungsgesetz der Kontinuität?", 500, 190);
  textAlign (CENTER, BOTTOM);     
 

// Bilder laden 

// ___________________________

  if (Bild1A == true){
    img1 = loadImage("image_01.png");
    image (img1, 100, 300, 200, 200 ); 
  }
  if (Bild1B == true) {
    img1 = loadImage("image_01.png");
  image (img1, 400, 300, 200, 200);
  }
  if (Bild1C == true) {
    img1 = loadImage("image_01.png");
   image (img1, 700, 300, 200, 200);
  }

// ___________________________

  if (Bild2A == true){
    img2 = loadImage("image_02.png");
    image (img2, 100, 300, 200, 200); 
  }
  if (Bild2B == true){
    img2 = loadImage("image_02.png");
     image (img2, 400, 300, 200, 200);
  }
  if (Bild2C == true){
    img2 = loadImage("image_02.png");
  image (img2, 700, 300, 200, 200);
  }
  
  // ________________________
  
  if (Bild3A == true) {
    img3 = loadImage("image_03.png");
  image (img3, 100, 300, 200, 200 ); 
  }
  if (Bild3B == true) {
    img3 = loadImage("image_03.png");
 image (img3, 400, 300, 200, 200); 
  }
  if (Bild3C == true) {
    img3 = loadImage("image_03.png");
   image (img3, 700, 300, 200, 200); 
  }
  
  
  // ______________
  
  if (Variante == 1) {
    Bild1A = true;
    Bild1B = false; 
    Bild1C = false;
    
    Bild2A = false;
    Bild2B = true;
    Bild2C = false;
    
    Bild3A = false;
    Bild3B = false;
    Bild3C = true;
  }
  
  if (Variante == 2) {
    Bild1A = false;
    Bild1B = true;
    Bild1C = false;
    
    Bild2A = false;
    Bild2B = false;
    Bild2C = true;
    
    Bild3A = true;
    Bild3B = false;
    Bild3C = false;
    
  }
  
  if (Variante == 3){
    Bild1A = false;
    Bild1B = false;
    Bild1C = true;
    
    Bild2A = true;
    Bild2B = false;
    Bild3C = false;
    
    Bild3A = false;
    Bild3B = true;
    Bild3C = false;
    
  }
  
  if (Variante == 4) {
    Bild1A = true;
    Bild1B = false;
    Bild1C = false;
    
    Bild2A = false;
    Bild2B = false;
    Bild2C = true;
    
    Bild3A = false;
    Bild3B = true;
    Bild3C = false;
    
  }
  
  if (Variante == 5) {
    Bild1A = false;
    Bild1B = true;
    Bild1C = false;
    
    Bild2A = true;
    Bild2B = false;
    Bild2C = false;
    
    Bild3A = false;
    Bild3B = false;
    Bild3C = true;
    
  }
  
  if (Variante == 6) {
    Bild1A = false;
    Bild1B = false;
    Bild1C = true;
    
    Bild2A = false;
    Bild2B = true;
    Bild2C = false;
    
    Bild3A = true;
    Bild3B = false;
    Bild3C = false;
    
  }
  
  // Abfrage ob richtig angeklickt 
  
  if (Variante == 1 && mousePressed && mouseX > 500 && mouseX <550 && mouseY>550 && mouseY<600) { //B
    text("richtig!", 500, 300);
  } 
  
  /*
  else if (Variante == 2 && mouseClicked && mouseX > 150 && mouseX < 250 && mouseY >520 && mouseY < 580){
    text("richtig!", 500, 300);
    }
    else if (Variante == 3 && mousePressed && mouseX > 750 && mouseX< 850 && mouseY>520 && mouseY<580 ) {
      text("richtig!", 500, 300);
    } 
    else if ( Variante == 4 && mousePressed && mouseX > 750 && mouseX< 850 && mouseY>520 && mouseY<580 ) {
      text("richtig!", 500, 300);
    } 
    else if (Variante == 5 && mousePressed && mouseX > 450 && mouseX <550 && mouseY>520 && mouseY<580){ //A
    text("richtig!", 500, 300);
    } 
    else if ( Variante == 6 && mousePressed && mouseX > 150 && mouseX < 250 && mouseY >520 && mouseY < 580){
    text("richtig!", 500, 300);
    }
    */
      
    
    
  
 // ____________________________________
 
// rechtecke für Auswahlmöglichkeiten   
  fill (rectColor);
  fill (rectA);
  rect ( 200, 550, 50, 50); 
  textColor = 0;          
  fill(textColor);
   text("A", 200, 570); 
  
  fill (rectB);
  rect ( 500, 550, 50, 50); 
  textColor = 0;          
  fill(textColor);
   text("B", 500, 570); 

  fill (rectC);
  rect ( 800, 550, 50, 50); 
      textColor = 0;          
  fill(textColor);
   text("C", 800, 570); 
  
 //Rechteck für Enter
 keyPressed();

```

// hover quiz auswahl enter

```
   /* && mousePressed && mouseX > 450 && mouseX <550 && mouseY>520 && mouseY<580 
    && mousePressed && mouseX > 150 && mouseX < 250 && mouseY >520 && mouseY < 580
    && mousePressed && mouseX > 750 && mouseX< 850 && mouseY>520 && mouseY<580 
    && mousePressed && mouseX > 750 && mouseX< 850 && mouseY>520 && mouseY<580
    && mousePressed && mouseX > 450 && mouseX <550 && mouseY>520 && mouseY<580
    && mousePressed && mouseX > 150 && mouseX < 250 && mouseY >520 && mouseY < 580) */
  // _____________________________
  
  hoverEffekt();
  
  // _____________________________
  
  mouseClicked ();
  
   
   

} 

}

```

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [January 2, 2023, 8:44pm UTC](https://discourse.processing.org/t/syntax-error-even-though-there-is-none/40417/6 "2023-01-02T20:44:30Z")

</div>

> [@iinnessic](#):
>
> keyPressed(); // Funktionsaufruf  
> //\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> mouseClicked (); // Funktionsaufruf  
> //\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> mousePressed(); // Funktionsaufruf

you don’t need to call those.

They are called automatically.

this runs:

```auto

// Gloable Variablen

// Button QUiz starten
int rectColor = #BECBDB;

// Farbe REechtecke A, B und C
boolean ButtonA = false;
boolean ButtonB = false;
boolean ButtonC = false;
int rectA;
int rectB;
int rectC;
int rectEnter;

int newSiteColor; // “neues” Fenster
int textColor; // Schriftfarbe
int bkColor; // hintergrundfarbe

// Bilder
PImage img1;
PImage img2;
PImage img3;

// wichtig für random funkton
boolean Bild1A = false;
boolean Bild1B = false;
boolean Bild1C = false;
boolean Bild2A = false;
boolean Bild2B = false;
boolean Bild2C = false;
boolean Bild3A = false;
boolean Bild3B = false;
boolean Bild3C = false;

// wichtig für Random Funktion
int Variante;

// Helvetica einsetzen
PFont font;

// Enter shortcut

void setup () { 

  size (1000, 800);  
  bkColor = #DAD4CB; 
  background (bkColor);
  font = createFont("Helvetica.vlw", 14);
} 

void draw () { 

  // QUiz Button
  rectMode(CENTER); 
  fill (rectColor); 
  rect ( 500, 720, 100, 60); 

  //hoverEffekt(); // hover Effekt 

  // __________________________________________ 

  // textFunktion(); // Funktionsaufruf 

  // ____________________________________________
  // keyPressed(); // Funktionsaufruf
  // ____________________________________________
  // mouseClicked (); // Funktionsaufruf
  // ____________________________________________
  // mousePressed(); // Funktionsaufruf
  // ____________________________________________

  // Wenn hintergrund weiß ist, dann folgende Code ausführen:
  if (bkColor == #BECBDB) { 

    // erstellt eine "neue" Seite   
    newSiteColor = #DAD4CB;    
    fill (newSiteColor); 
    rect(0, 0, 100000, 8000); 

    // Aufgabenstellung
    textSize(30); 
    fill(0); 
    text("Welche Darstellung entspricht", 500, 150); 
    text("dem Gestaltungsgesetz der Kontinuität?", 500, 190);
    textAlign (CENTER, BOTTOM);     

    // Bilder laden 

    // ___________________________

    if (Bild1A == true) {
      img1 = loadImage("image_01.png");
      image (img1, 100, 300, 200, 200 );
    }
    if (Bild1B == true) {
      img1 = loadImage("image_01.png");
      image (img1, 400, 300, 200, 200);
    }
    if (Bild1C == true) {
      img1 = loadImage("image_01.png");
      image (img1, 700, 300, 200, 200);
    }

    // ___________________________

    if (Bild2A == true) {
      img2 = loadImage("image_02.png");
      image (img2, 100, 300, 200, 200);
    }
    if (Bild2B == true) {
      img2 = loadImage("image_02.png");
      image (img2, 400, 300, 200, 200);
    }
    if (Bild2C == true) {
      img2 = loadImage("image_02.png");
      image (img2, 700, 300, 200, 200);
    }

    // ________________________

    if (Bild3A == true) {
      img3 = loadImage("image_03.png");
      image (img3, 100, 300, 200, 200 );
    }
    if (Bild3B == true) {
      img3 = loadImage("image_03.png");
      image (img3, 400, 300, 200, 200);
    }
    if (Bild3C == true) {
      img3 = loadImage("image_03.png");
      image (img3, 700, 300, 200, 200);
    }

    // ______________

    if (Variante == 1) {
      Bild1A = true;
      Bild1B = false; 
      Bild1C = false;

      Bild2A = false;
      Bild2B = true;
      Bild2C = false;

      Bild3A = false;
      Bild3B = false;
      Bild3C = true;
    }

    if (Variante == 2) {
      Bild1A = false;
      Bild1B = true;
      Bild1C = false;

      Bild2A = false;
      Bild2B = false;
      Bild2C = true;

      Bild3A = true;
      Bild3B = false;
      Bild3C = false;
    }

    if (Variante == 3) {
      Bild1A = false;
      Bild1B = false;
      Bild1C = true;

      Bild2A = true;
      Bild2B = false;
      Bild3C = false;

      Bild3A = false;
      Bild3B = true;
      Bild3C = false;
    }

    if (Variante == 4) {
      Bild1A = true;
      Bild1B = false;
      Bild1C = false;

      Bild2A = false;
      Bild2B = false;
      Bild2C = true;

      Bild3A = false;
      Bild3B = true;
      Bild3C = false;
    }

    if (Variante == 5) {
      Bild1A = false;
      Bild1B = true;
      Bild1C = false;

      Bild2A = true;
      Bild2B = false;
      Bild2C = false;

      Bild3A = false;
      Bild3B = false;
      Bild3C = true;
    }

    if (Variante == 6) {
      Bild1A = false;
      Bild1B = false;
      Bild1C = true;

      Bild2A = false;
      Bild2B = true;
      Bild2C = false;

      Bild3A = true;
      Bild3B = false;
      Bild3C = false;
    }

    // Abfrage ob richtig angeklickt 

    if (Variante == 1 && mousePressed && mouseX > 500 && mouseX <550 && mouseY>550 && mouseY<600) { //B
      text("richtig!", 500, 300);
    } 

    /*
  else if (Variante == 2 && mouseClicked && mouseX > 150 && mouseX < 250 && mouseY >520 && mouseY < 580){
     text("richtig!", 500, 300);
     }
     else if (Variante == 3 && mousePressed && mouseX > 750 && mouseX< 850 && mouseY>520 && mouseY<580 ) {
     text("richtig!", 500, 300);
     } 
     else if ( Variante == 4 && mousePressed && mouseX > 750 && mouseX< 850 && mouseY>520 && mouseY<580 ) {
     text("richtig!", 500, 300);
     } 
     else if (Variante == 5 && mousePressed && mouseX > 450 && mouseX <550 && mouseY>520 && mouseY<580){ //A
     text("richtig!", 500, 300);
     } 
     else if ( Variante == 6 && mousePressed && mouseX > 150 && mouseX < 250 && mouseY >520 && mouseY < 580){
     text("richtig!", 500, 300);
     }
     */

    // ____________________________________

    // rechtecke für Auswahlmöglichkeiten   
    fill (rectColor);
    fill (rectA);
    rect ( 200, 550, 50, 50); 
    textColor = 0;          
    fill(textColor);
    text("A", 200, 570); 

    fill (rectB);
    rect ( 500, 550, 50, 50); 
    textColor = 0;          
    fill(textColor);
    text("B", 500, 570); 

    fill (rectC);
    rect ( 800, 550, 50, 50); 
    textColor = 0;          
    fill(textColor);
    text("C", 800, 570); 

    //Rechteck für Enter
    // keyPressed();

    // hover quiz auswahl enter

    /* && mousePressed && mouseX > 450 && mouseX <550 && mouseY>520 && mouseY<580 
     && mousePressed && mouseX > 150 && mouseX < 250 && mouseY >520 && mouseY < 580
     && mousePressed && mouseX > 750 && mouseX< 850 && mouseY>520 && mouseY<580 
     && mousePressed && mouseX > 750 && mouseX< 850 && mouseY>520 && mouseY<580
     && mousePressed && mouseX > 450 && mouseX <550 && mouseY>520 && mouseY<580
     && mousePressed && mouseX > 150 && mouseX < 250 && mouseY >520 && mouseY < 580) */
    // _____________________________

    //hoverEffekt();

    // _____________________________

    //mouseClicked ();
  }
}

void mousePressed () {
  Variante = int ( random (1, 6));
}

```

---

<div class="post-metadata">

### Author: ![iinnessic](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@iinnessic](https://discourse.processing.org/u/iinnessic)
#### Post date: [January 2, 2023, 8:49pm UTC](https://discourse.processing.org/t/syntax-error-even-though-there-is-none/40417/7 "2023-01-02T20:49:38Z")

</div>

> [@Chrisir](#):
>
> ```auto
> void mousePressed () {
> Variante = int ( random (1, 6));
> }
> 
> ```

It still doesnt… I tried

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [January 2, 2023, 8:51pm UTC](https://discourse.processing.org/t/syntax-error-even-though-there-is-none/40417/8 "2023-01-02T20:51:28Z")

</div>

maybe the error is somewhere else

I commented out all keyPressed calls and mousePressed and so on

---

<div class="post-metadata">

### Author: ![javagar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/javagar/32/11434_2.png) [@javagar](https://discourse.processing.org/u/javagar)
#### Post date: [January 2, 2023, 8:57pm UTC](https://discourse.processing.org/t/syntax-error-even-though-there-is-none/40417/9 "2023-01-02T20:57:03Z")

</div>

Please copy and paste the error message so we can see it exactly as is. Also, is the `mousePressed()` function that you posted in a file all by itself? If there is any code that precedes it, the problem might be there. For example, a syntax error might be the result of a parenthesis that was not closed prior to a function definition or other block of code that does not belong inside parentheses.

---

<div class="post-metadata">

### Author: ![iinnessic](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@iinnessic](https://discourse.processing.org/u/iinnessic)
#### Post date: [January 2, 2023, 9:10pm UTC](https://discourse.processing.org/t/syntax-error-even-though-there-is-none/40417/10 "2023-01-02T21:10:44Z")

</div>

That’s the message:  
Syntaxfehler - Missing operator, semicolon, or ‘}’ near ‘mousePressed’?

And the mousePressed() function is in a tab all by itself.  
I searched for errors in the other tabs and couldn’t find it…

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [January 2, 2023, 9:44pm UTC](https://discourse.processing.org/t/syntax-error-even-though-there-is-none/40417/11 "2023-01-02T21:44:12Z")

</div>

this runs with all tabs

```auto

// Gloable Variablen

// Button QUiz starten
int rectColor = #BECBDB;

// Farbe REechtecke A, B und C
boolean ButtonA = false;
boolean ButtonB = false;
boolean ButtonC = false;
int rectA;
int rectB;
int rectC;
int rectEnter;

int newSiteColor; // “neues” Fenster
int textColor; // Schriftfarbe
int bkColor; // hintergrundfarbe

// Bilder
PImage img1;
PImage img2;
PImage img3;

// wichtig für random funkton
boolean Bild1A = false;
boolean Bild1B = false;
boolean Bild1C = false;
boolean Bild2A = false;
boolean Bild2B = false;
boolean Bild2C = false;
boolean Bild3A = false;
boolean Bild3B = false;
boolean Bild3C = false;

// wichtig für Random Funktion
int Variante;

// Helvetica einsetzen
PFont font;

// Enter shortcut

void setup () { 

  size (1000, 800);  
  bkColor = #DAD4CB; 
  background (bkColor);
  font = createFont("Helvetica.vlw", 5);
} 

void draw () { 

  // QUiz Button
  rectMode(CENTER); 
  fill (rectColor); 
  rect ( 500, 720, 100, 60); 

  hoverEffekt(); // hover Effekt 

  // __________________________________________ 

  textFunktion(); // Funktionsaufruf 

  // ____________________________________________
  keyPressed(); // Funktionsaufruf
  // ____________________________________________
  mouseClicked (); // Funktionsaufruf
  // ____________________________________________
  mousePressed(); // Funktionsaufruf
  // ____________________________________________

  // Wenn hintergrund weiß ist, dann folgende Code ausführen:
  if (bkColor == #BECBDB) { 

    // erstellt eine "neue" Seite   
    newSiteColor = #DAD4CB;    
    fill (newSiteColor); 
    rect(0, 0, 100000, 8000); 

    // Aufgabenstellung
    textSize(30); 
    fill(0); 
    text("Welche Darstellung entspricht", 500, 150); 
    text("dem Gestaltungsgesetz der Kontinuität?", 500, 190);
    textAlign (CENTER, BOTTOM);     

    // Bilder laden 

    // ___________________________

    if (Bild1A == true) {
      img1 = loadImage("image_01.png");
      image (img1, 100, 300, 200, 200 );
    }
    if (Bild1B == true) {
      img1 = loadImage("image_01.png");
      image (img1, 400, 300, 200, 200);
    }
    if (Bild1C == true) {
      img1 = loadImage("image_01.png");
      image (img1, 700, 300, 200, 200);
    }

    // ___________________________

    if (Bild2A == true) {
      img2 = loadImage("image_02.png");
      image (img2, 100, 300, 200, 200);
    }
    if (Bild2B == true) {
      img2 = loadImage("image_02.png");
      image (img2, 400, 300, 200, 200);
    }
    if (Bild2C == true) {
      img2 = loadImage("image_02.png");
      image (img2, 700, 300, 200, 200);
    }

    // ________________________

    if (Bild3A == true) {
      img3 = loadImage("image_03.png");
      image (img3, 100, 300, 200, 200 );
    }
    if (Bild3B == true) {
      img3 = loadImage("image_03.png");
      image (img3, 400, 300, 200, 200);
    }
    if (Bild3C == true) {
      img3 = loadImage("image_03.png");
      image (img3, 700, 300, 200, 200);
    }

    // ______________

    if (Variante == 1) {
      Bild1A = true;
      Bild1B = false; 
      Bild1C = false;

      Bild2A = false;
      Bild2B = true;
      Bild2C = false;

      Bild3A = false;
      Bild3B = false;
      Bild3C = true;
    }

    if (Variante == 2) {
      Bild1A = false;
      Bild1B = true;
      Bild1C = false;

      Bild2A = false;
      Bild2B = false;
      Bild2C = true;

      Bild3A = true;
      Bild3B = false;
      Bild3C = false;
    }

    if (Variante == 3) {
      Bild1A = false;
      Bild1B = false;
      Bild1C = true;

      Bild2A = true;
      Bild2B = false;
      Bild3C = false;

      Bild3A = false;
      Bild3B = true;
      Bild3C = false;
    }

    if (Variante == 4) {
      Bild1A = true;
      Bild1B = false;
      Bild1C = false;

      Bild2A = false;
      Bild2B = false;
      Bild2C = true;

      Bild3A = false;
      Bild3B = true;
      Bild3C = false;
    }

    if (Variante == 5) {
      Bild1A = false;
      Bild1B = true;
      Bild1C = false;

      Bild2A = true;
      Bild2B = false;
      Bild2C = false;

      Bild3A = false;
      Bild3B = false;
      Bild3C = true;
    }

    if (Variante == 6) {
      Bild1A = false;
      Bild1B = false;
      Bild1C = true;

      Bild2A = false;
      Bild2B = true;
      Bild2C = false;

      Bild3A = true;
      Bild3B = false;
      Bild3C = false;
    }

    // Abfrage ob richtig angeklickt 

    if (Variante == 1 && mousePressed && mouseX > 500 && mouseX <550 && mouseY>550 && mouseY<600) { //B
      text("richtig!", 500, 300);
    } 

    /*
  else if (Variante == 2 && mouseClicked && mouseX > 150 && mouseX < 250 && mouseY >520 && mouseY < 580){
     text("richtig!", 500, 300);
     }
     else if (Variante == 3 && mousePressed && mouseX > 750 && mouseX< 850 && mouseY>520 && mouseY<580 ) {
     text("richtig!", 500, 300);
     } 
     else if ( Variante == 4 && mousePressed && mouseX > 750 && mouseX< 850 && mouseY>520 && mouseY<580 ) {
     text("richtig!", 500, 300);
     } 
     else if (Variante == 5 && mousePressed && mouseX > 450 && mouseX <550 && mouseY>520 && mouseY<580){ //A
     text("richtig!", 500, 300);
     } 
     else if ( Variante == 6 && mousePressed && mouseX > 150 && mouseX < 250 && mouseY >520 && mouseY < 580){
     text("richtig!", 500, 300);
     }
     */

    // ____________________________________

    // rechtecke für Auswahlmöglichkeiten   
    fill (rectColor);
    fill (rectA);
    rect ( 200, 550, 50, 50); 
    textColor = 0;          
    fill(textColor);
    text("A", 200, 570); 

    fill (rectB);
    rect ( 500, 550, 50, 50); 
    textColor = 0;          
    fill(textColor);
    text("B", 500, 570); 

    fill (rectC);
    rect ( 800, 550, 50, 50); 
    textColor = 0;          
    fill(textColor);
    text("C", 800, 570); 

    //Rechteck für Enter
    keyPressed();

    // hover quiz auswahl enter

    /* && mousePressed && mouseX > 450 && mouseX <550 && mouseY>520 && mouseY<580 
     && mousePressed && mouseX > 150 && mouseX < 250 && mouseY >520 && mouseY < 580
     && mousePressed && mouseX > 750 && mouseX< 850 && mouseY>520 && mouseY<580 
     && mousePressed && mouseX > 750 && mouseX< 850 && mouseY>520 && mouseY<580
     && mousePressed && mouseX > 450 && mouseX <550 && mouseY>520 && mouseY<580
     && mousePressed && mouseX > 150 && mouseX < 250 && mouseY >520 && mouseY < 580)
     */
    // _____________________________

    hoverEffekt();

    // _____________________________

    mouseClicked ();
  }
}

void mousePressed () {
  Variante = int ( random (1, 6));
}

void hoverEffekt() {

  // hover quiz start
  if (mouseX > 450 && mouseX < 550 && mouseY >690 && mouseY < 780) { // wenn maus über rechteck ist 
    if (mousePressed) { // wenn auf starten gedrückt wird, dann soll hintergrund weiß werden 
      bkColor =#BECBDB;
    }
    rectColor = #FEFF24; 
    println("maus ist über box");
  } else { // wenn nicht, dann... 
    rectColor = #BECBDB;
  }

  // Hover und Farbveränderung bei Auswahlmöglichkeiten
  if (mouseX > 150 && mouseX < 250 && mouseY >520 && mouseY < 580) { // wenn maus über rechteck ist 
    rectA = #FEFF24; //gelb
    println ("maus ist über A");
  } else {
    rectA = #BECBDB;
  }

  // Rechteck A wird Orange beim Klicken 
  if (mousePressed && mouseX > 150 && mouseX < 250 && mouseY >520 && mouseY < 580 ) {    
    rectA = #F5C720 ;
    ButtonA = true; 
    println ("A wird Orange");
  }

  // ______________________________

  if (mouseX > 450 && mouseX <550 && mouseY>520 && mouseY<580) {
    rectB = #FEFF24;
    println ("maus ist über B");
  } else {
    rectB = #BECBDB;
  }

  if (mousePressed && mouseX > 450 && mouseX <550 && mouseY>520 && mouseY<580) {
    rectB = #F5C720;
    println ("B wird Orange");
  }

  // ____________________________

  if (mouseX > 750 && mouseX< 850 && mouseY>520 && mouseY<580 ) {
    rectC = #FEFF24;
    println ("maus ist über C");
  } else {
    rectC = #BECBDB;
  }

  if (mousePressed && mouseX > 750 && mouseX< 850 && mouseY>520 && mouseY<580 ) {
    rectC = #F5C720;
    println ("C wird Orange");
  }

  // ______________________________

  // Hover und Farbveränderung bei Enter

  if (mouseX > 450 && mouseX <550 && mouseY>520 && mouseY<580) {
    rectEnter = #FEFF24;
    println ("maus ist über Enter");
  } else {
    rectEnter = #BECBDB;
  }

  if (mousePressed && mouseX > 450 && mouseX <550 && mouseY>520 && mouseY<580) {
    rectEnter = #F5C720;
    println ("Enter wird Orange");
  }
  // ____________________________________
}

void textFunktion() {
  textColor = 0;

  textFont (font);
  fill (#433D68);
  textSize (70);
  textAlign (CENTER, BOTTOM);
  text ("Gestaltgesetze", 500, 150);
  fill (textColor);
  textSize (40);
  textAlign (CENTER, CENTER);
  text ("Teilaufgabe 1 | WS 22/23", 500, 300);
  text ("Interaktive Werkzeuge | Prof. Ralph Tille", 500, 380);
  textSize (20);
  textAlign (CENTER, CENTER);
  text ("INES KURTOVIC | ik057", 500, 460);
  textSize (40);
  textAlign (CENTER, TOP);
  text ("Kennst du die Gestaltgesetze?", 500, 600);
  fill (0);
  textSize (30);
  textAlign (CENTER, TOP);
  text ("Quiz", 500, 700);
}

```
