Link button answers to randomised questions

Hello, so it’s the first game I make with a development program and I found it nice how I was able to create a randomiser of my array of questions so fast!

I created only 1 scene in which the text changes randomly and never repeats once the specific question has appeared

Next thing I need to understand is how do I link these randomised questions to their respective correct true/false answer? Because I won’t always have the correct answer as true, but of course it’ll change depending on the question! And then as an action to the correct answer I’ll add a +1 to the score, and the false answer will just change question. The answers are just buttons (made from sprite) so no need of a text input from the user.

I hope i’ve been detailed enough to be clear,
Thanks and kind regards.

You can do it a number of ways.

  1. Have a second array that holds all the answers, with the order the same as their questions. When you remove from the question array, also remove from the answer array

  2. Instead of having the question as the array element, make it a structure. Make one structure element the question, the other the answer :

For the second way (one I prefer, as you’ve got the question and answer together and so easier to maintain), you can set it up like :


You get the questions and answers with :

Hey! Thanks it works and it’s glorious!

But now I do have a doubt now, how do I click on the answers? And therefore add a +1 on a score system that I want to implement after clicking on the correct answer?

That depends on how you intend to display the answer - is it multi choice, does the player have to type in the answer, or some other way?

Haha so I was just playing on it and I’ll show you what I did

It is multichoice, the player just needs to click on the right answer. In my current progress, even if I just hover over the correct answer I just print inifite 1s on the score text, while if i hover over the wrong asnwer it just says incorrect. What I want is to just add a +1 to the number shown on the score every time the user clicks on the right answer.

Would it be something like I did here?

You’ll want to add a Mouse button pressed/touch held and a Trigger once while true to both the The cursor/touch is on... conditions.

1 Like

It works wonderfully thanks. One last question : once I finished the quiz’s questions, how do I make it change the scene to, for example, a scene that tells you how much you scored?

I don’t think this is the right path, but what I’m basically trying to do is that once the random questions in my array have all been shown to the player (as in the timer of all questions has expired or the player has answered all the questions), I want to change scene.

How would you do It?
Thanks and kind regards

Maybe some of this can be helpful: [Example] Simple math test (randomized, with multiple answers)

You use the Change scene action. Any data needed from the game scene to be used in the score scene should be put into global variables.


As each question is presented, I would remove it from the array and check if the array’s child count is 0.

Otherwise, if you are keeping track of how many questions have been asked, compare that value with the number of children in the array :

2 Likes