I’m stuck that I cannot make a song match a random question.
Can anybody help, please?
import processing.sound.*;
SoundFile file;
String[] Texts = {
"Question A",
"Question B",
"Question C",
"Question D",
"Question E",
"Question F",
"Question G"
};
String[] RightAnswer = {
"Yes",
"No",
"Yes",
"No",
"No",
"Yes",
"No"
};
int n = int (random(0, 6));
//String myText;
int totalWrong = 0;
int totalCorrect = 0;
//int question = 0;
//String correctAnswer;
//String WrongAnswer;
//int True= 0;
//int False= 0;
void setup() {
size(800, 400);
background(255);
smooth();
ellipseMode(CENTER);
}
void draw() {
// draw() runs 60 times per second again and again
// we clear the screen to WHITE
background(255);
// we show stuff
noStroke();
//Button 1
fill(255, 20, 40);
if (button1())
fill(0, 255, 0);
ellipse(320, 100, 20, 20);
text("YES", 320+22, 100);
//Button 2
fill(255, 20, 40);
if (button2())
fill(0, 255, 0);
ellipse(420, 100, 20, 20);
text("NO", 420+22, 100);
fill(0);
rect(width/2, height/2, 300, 100);
textSize(20);
text(Texts[n], 10, 30);
if (Texts[0]), file.play();
text(RightAnswer[n], 10, 30+22);```