It would be a bit long to explain in detail, but in summary (I’m improvising):
You need a main scene to show all the questions, a structure variable (scene or global) with the list of questions, a global variable with the current question index, and two global variables with the number of corrects and incorrect answers.
The structure should look like this:
question "Is yesn't a valid word?"
question "Is the Earth flat?"
answer2 "Of course not"
answer3 "iS tHe EaRtH fLaT?"
So to access the second question you do:
Or dynamically as you’ll need it:
The global variable that stores the current question index will be “currentQuestion” and must start at 1.
With this index you access the question (as described above but using the “currentQuestion” variable) and show it in a text object.
Then you’ve to show the possible answers, you can separate text and button, but I’ll use the text as a button for simplicity. For example for the third button you have to set two values, the text with the answer and a value with the answer index:
Do = VariableString(Questions[GlobalVariableString(currentQuestion)]["answer" + ToString(3)]) to the Text of AnswerText
Do = 3 to variable "answerIndex" of AnswerText
The last step is checking the clicked answer, it will be correct if the “answerIndex” variable of the button is the same than the correct answer (it’s saved in the structure). If the value is correct increase a “corrects” global variable, otherwise an “incorrects” variable. Then increase the current question index and reset the scene to go for the next question:
[code]Conditions: Left mouse button pressed
Cursor is on AnswerText
Conditions: Text of variable "answerIndex" is = VariableString(Questions[GlobalVariableString(currentQuestion)].correctAnswer)
Actions: Do + 1 to global variable "corrects"
Conditions: Text of variable "answerIndex" is != VariableString(Questions[GlobalVariableString(currentQuestion)].correctAnswer)
Actions: Do + 1 to global variable "incorrects"
Conditions: No conditions
Actions: Do + 1 to global variable "currentQuestion"
Change to scene "ThisSceneNameAgain"[/code]
Done, that should be enough to get an idea. Of course there are lots of things to do: creating the buttons, set and use their index correctly (here I’ve used a fixed “3” for the third button), you’ll want to test if the current question index is greater than the number of questions you have, and if so go to the game over scene to show the number of corrects and wrong answers (that’s why these variables are globals), etc.
There are also two extra things you can do, but I didn’t explain here because it’s a topic itself: show the questions in a random order (right now they will always follow the same order) and randomize the answers position, you can even put extra wrong answers to pick them randomly too. Just a lot of extra polishing design