How do I make a multi-answer quiz?

1 favourites
From the Asset Store
Comprehensive localization solution for Construct 3 projects, no addons required!
  • Hey guys! So before I made an app with a quiz. The quiz had a question and 4-5 choices, with 2-3 answers

    Like

    (qn) blah blah blah

    1. correct

    2. Wrong

    3. Correct

    4. Wrong

    5. Correct

    It took me a long time, but finally I finished and going to publish soon. Thank you dop2000, , ClausxD, DiegoM, savvito123, AllanR, Maverick1912, Lancifer, LesleyBeth, LOxR, and DAMAJIANG. After that I tried to find if there was an easier way to do this using a database perhaps. I looked it up but only found quiz templates with one correct answer. Is there any way?

  • Using a 3D array to store the answers may work for you:

    Width = question no.

    Height = answers

    Depth = correct/incorrect

    You can transfer the current question's answers to a separate 2D array if you want to shuffle them before displaying.

  • Using a 3D array to store the answers may work for you:

    Width = question no.

    Height = answers

    Depth = correct/incorrect

    You can transfer the current question's answers to a separate 2D array if you want to shuffle them before displaying.

    Is there any sample project you could show? I'm not familiar with arrays,

  • Congrats on finishing the project.

    Have you fixed that messy code you used to checks if the answer is correct?

  • You can use AJAX.

    This is a structure of a quiz game that I made:

    img-1: The question, in my game is image quest, you can change to text in your game.

    The next 4 items are the selections.

    The last one will be the correct answer.

    And you separate each question with a "|".

    You can save all questions into a txt file.

    The AJAX will read from the txt file and put each of them into an Array.

    Then load each question from the Index of Array: 0,1,2,...

    Example: Quest 1: img-1; God of Fire; Fire Burst; Ignite; Fiery Dance; God of Fire;

    Use a variable to store the correct answer.

    When user click the selection, you can compare with the correct answer.

  • Here's an example using an AJAX + array that lets you set any number of correct answers:

    dropbox.com/s/5inhie14yi7rolr/quizTemplate.c3p

    Both the questions and answers are shuffled using permutation tables.

    I've added comments throughout the event sheet to explain how it works.

  • Here's an example using an AJAX + array that lets you set any number of correct answers:

    https://www.dropbox.com/s/5inhie14yi7rolr/quizTemplate.c3p?dl=0

    Both the questions and answers are shuffled using permutation tables.

    I've added comments throughout the event sheet to explain how it works.

    Thanks. I'll check it out!

  • Congrats on finishing the project.

    Have you fixed that messy code you used to checks if the answer is correct?

    I tried following it your way but it wasnt fitting with my project (new bugs appeared). So maybe (if I make a new project) than i'll try your code.

  • Please trust that my code is fitting your project much better than your code.

    The general rule of thumb is that if you need to repeat something more than 2 times, then you are doing it wrong.

    Making 20 layouts for 20 quiz questions is wrong. Making 20 identical Player sprites and 100 checkbox objects for those layouts is wrong. Having 500 events and 1000 actions just to check the correct answers is terribly wrong.

    Don't copy-paste your broken code, don't discard words of advice that you don't understand. Try to learn new things (functions, families, arrays etc.) and you will see how easy it is in fact to make good working apps in Construct.

  • Here's an example using an AJAX + array that lets you set any number of correct answers:

    https://www.dropbox.com/s/5inhie14yi7rolr/quizTemplate.c3p?dl=0

    Both the questions and answers are shuffled using permutation tables.

    I've added comments throughout the event sheet to explain how it works.

    So This is like. when you check it shows wrong or correct, right? So what if it was like you check (whatever you need to check) then press submit. The right answers become green and the wrong become red?

  • Here's an example that lets you select answers and then submit:

    dropbox.com/s/qc9dourwsf4f7g6/quizTemplate2.c3p

  • Here's an example that lets you select answers and then submit:

    https://www.dropbox.com/s/qc9dourwsf4f7g6/quizTemplate2.c3p?dl=0

    Wow! this is amzaing! Thank you!

  • Here's an example that lets you select answers and then submit:

    https://www.dropbox.com/s/qc9dourwsf4f7g6/quizTemplate2.c3p?dl=0

    Since this is random, the first one will be (lets say) question 3. then the 2nd one Question 2 . Is there any way to change that written above? if not its ok. I'll just not have it written there

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You're welcome :-)

    If you don't want to shuffle the questions, disable the call to the shuffleQuestion function in the On Start event.

    If you don't want to shuffle the answers, in event 5 you can swap both references to AdvancedRandom.Permutation(loopindex("j") to just loopindex("j")

  • Here's an example that lets you select answers and then submit:

    https://www.dropbox.com/s/qc9dourwsf4f7g6/quizTemplate2.c3p?dl=0

    Did you make th json folder in construct 3 or..

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)