here is a working version. There were a lot of small things to fix.
(as I said: Arrays)
Chrisir
int flag = 0;
void setup() {
size( 1366, 768);
background(255);
}//func
void draw() {
background(255);
actOnFlag();
}//func
// -------------------------------------------------
void actOnFlag() {
if (flag == 0) {
// Question 1
pushStyle();
background(255);
fill(255, 0, 0);
rect (700, 300, 300, 300);
fill(0, 255, 0);
rect (300, 300, 300, 300);
fill(0, 0, 0);
text("1. Aussage:", 600, 150);
text("Wir haben einen nicht gelisteten Helfer.", 350, 190);
textSize(32);
fill(0, 51, 0);
text("WAHR", 400, 450);
textSize(32);
fill( 128, 0, 0);
text("FALSCH", 800, 450);
popStyle();
} else if (flag == 1) {
// Correct
pushStyle();
background(255);
fill(0, 255, 0);
textSize(42);
text("Richtig!", 600, 150);
fill(0);
rect(600, 300, 300, 300);
textSize(32);
fill(255);
text("Nächste", 700, 400);
text("Aussage->", 700, 450);
popStyle();
} else if (flag == 2) {
// Wrong
pushStyle();
background(255);
fill(255, 0, 0);
text("Falsch!", 600, 150);
fill(0);
rect(600, 300, 300, 300);
textSize(32);
fill(255);
text("Nächste", 700, 400);
text("Aussage->", 700, 450);
popStyle();
} else if (flag == 3) {
// Question 2
pushStyle();
background(255);
fill(255, 0, 0);
rect (700, 300, 300, 300);
fill(0, 255, 0);
rect (300, 300, 300, 300);
fill(0, 0, 0);
text("2. Aussage:", 600, 150);
text("Wir sind das erste Mal dabei.", 350, 190);
textSize(32);
fill(0, 51, 0);
text("WAHR", 400, 450);
textSize(32);
fill( 128, 0, 0);
text("FALSCH", 800, 450);
popStyle();
} else {
background(255);
fill(255, 0, 0);
text("Else: "+flag, 600, 150);
}
}//func
// -------------------------------------------------
void mousePressed() {
println("MouseX: " + mouseX + " MouseY: " + mouseY + " Flag: " + flag);
if (flag == 0) {
// Question 1
if (mouseX>300 && mouseX < 600 && mouseY >300 && mouseY <600) {
flag = 1;
}
if (dist(mouseX, mouseY, 849, 450)<125) {
flag = 2;
}
}
//------------------------
// Two result screens with a "Next button"
else if (flag == 1) {
// Correct
if (mouseX>600 && mouseX < 900 && mouseY >300 && mouseY <600) {
flag = 3; // both proceed to Question 2
}
} else if (flag == 2) {
// Wrong
if (mouseX>600 && mouseX < 900 && mouseY >300 && mouseY <600) {
flag = 3; // both proceed to Question 2
}
}
//---------------------
else if (flag == 3) {
// Question 2
if (mouseX>300 && mouseX < 600 && mouseY >300 && mouseY <600) {
flag = 4;
}
if (dist(mouseX, mouseY, 850, 450)<125) {
flag = 5;
}
}//if
//--------------------
else {
// flag = 0;
}
//
}//func
//