How to make a quiz game

0 favourites
  • 11 posts
From the Asset Store
Guess the sound Quiz is an amazing and innovative app for kids to learn the different animal sounds.
  • I'm thinking of making a turn-based endless side scrolling game which you attack by answering multiple choice questions from a question database. So there are endless levels, each level 10 waves of monsters, a boss at the end, and you get to upgrade your items and recover hp and save.

    How do I start? There isn't any tutorial involving quiz around. Please teach me, thank you.

  • The basics are pretty simple

    create question

    create answers

    on right answer clicked -Yay! :)

    on wrong answer clicked -Booo! :(

    So the question is, what do you not know how to do?

  • I have questions from 10 different categories. I want to be able to check/uncheck in the options whether to show questions from a certain category. I want to put all the questions into 10 different .txt files, naming them each into the names of their respective subjects, and dumping the 10 files into a folder and just make the folder the questions database. In the .txt files, I want to set the questions in the format

    [qn]blah blah blah

    [1]correct answer

    [2]wrong answer

    [3]wrong answer

    [4]wrong answer

    [5]wrong answer

    the catch is, in the file, the correct answer will always be the 1st option, but when playing the game the answer options must be shuffled. And when the wrong option is chosen, the correct 1 is highlighted.

    Is this all possible? If so, please emphasize on the details as I'm new to this program, only using it to make a game to facilitate my studies

  • Maybe this topic (I found with the fabulous search-option on the top of this page) will help:

    Making a quiz game

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've seen that page already, and I did not understand Yann's example at all. The field I'm studying in has no relations to IT at all, so yeah pls be patient with me, I'm sorry.

    I understood procrastinator's example though. But he only seemed to use 1 txt file, how do i enable multiple txt file and options to enable/disable them in the game? How do I link answering correctly with the player attacking?

  • It's all about creating conditions and having actions performed when those conditions are met.

    want to use another textfile?

    on conditions met - use another text file

    want the player to attack?

    on conditions met (answer answered correctly) - set the actions for attack.

    The textfile could be set with a variable changing I guess

    if variable is 1 load textfile 1, etcetera.

  • uh, as I want to create an options panel where I can check/uncheck certain textfiles to use. Then in the game it will randomly generate questions from those selected textfiles. How do I edit from procrastinator's example to get this result? Thanks man, u've been a great help already

  • the questions part is easy, make a textfile, format it like this (you can use a different separator than ; ofc)

    Question 1?;right answer;wrong answer 1;wrong answer 2; wrong answer 3

    Question 2?;right answer;wrong answer 1;wrong answer 2; wrong answer 3

    and so on.

    Then you import that file as project file, load it in via the AJAX object.

    Then parse it into an array.

    After that you can easily work with the questions and answers in the array and load them into your game.

    example: copy.com/6dTNVXTviBkUcjsj

  • i need multiple textfiles for different subjects and i want to be able to check/uncheck whether the questions from a certain subject shows up in the game. Is it possible? E.g. if I have 10 subjects and I don't feel like revising chemistry today, I can uncheck the 'chemistry' in the game optionsso questions from 'chemistry' textfile wouldnt show up.

  • Sure, you have different options for separation.

    For example tag each question. (a new field for each line)

    You could use a different z-index for different text files/subjects. (I think I would prefer that one)

    You could use more than one array, one for each subject.

    You could use one text file and use another separator to divide subjects and you'll save the info somewhere which x-index-range contains which subject.

    Ofc depending on the way you separate the questions in your array(s), you must modify the algorithm that shows the questions.

    You can also add a tag to questions for their difficulty level.

    So a text file could look like this;

    Question 1?;right answer;wrong answer 1;wrong answer 2; wrong answer 3;1

    Question 2?;right answer;wrong answer 1;wrong answer 2; wrong answer 3;2

    Question 3?;right answer;wrong answer 1;wrong answer 2; wrong answer 3;2

    Question 4?;right answer;wrong answer 1;wrong answer 2; wrong answer 3;3

    1 would be easiest, 2 easy, 3 normal, and so on...

    And then let the game increase the difficulty over time.

  • By means of tokenat you can make tons of self made array approaches.

    simple approach:

    a text variable:

    you can create an array by using a comon character like a comma or pipe sign on which you can itterate through the sections.

    like

    text = 1,2,3,4,5,6,7

    tokenat arrays start counting at 0, so keep that in mind.

    tokenat(text, 0 , ",") = 1   

    tokenat(text, 1 , ",") = 2   

    etc

    This would all be sinle level arrays without keys, but straight up pieces of content.

    Extending this, making each piece alse have a list of options by means of a different comon character.

    text = 1,2,3,4 | 5,6,7,8,9 | 45,46,47

    This takes the second chunk of data from text:

    tokenat(text, 1, "|") = 5,6,7,8,9

    now, if I want the 8 from the second chunk of data, we simply nest the tokenat calls:

    tokenat(tokenat(text, 1, "|"), 2, ",") = 7

    tokenat(tokenat(text, 1, "|"), 3, ",") = 8

    tokenat(tokenat(text, 1, "|"), 4, ",") = 9

    this way it references single pieces from the second chunk, but you could easily loop through it:

    for each "looptokes"

    from: 0

    to: tokencount(tokenat(text, 1, "|"), ",")

    create text,

    set text tokenat(tokenat(text, 1, "|"), loopindex ,",")

    With the above approach, if you keep a uniform structure, like adding a question type first, then a question, then which of the following anwsers is correct, then some awnsers: either one or more. You have a full system that can dynamically expand as you add more.

    Or you could use objects having a text variable with these sets.

    example:

    obect questiontext, has instance variable awnser int()

    obect awnsertext, has instance variable awnser int()

    textvariable = multiplechoicetext,which is faster,0,train,horse,man|multiplechoiceimage,which color is red,2,image0,image1,image2,image3|inputquestion,how many cm are in a M,0,100

    The above variable shows examples of 3 type of questions.

    Looping through them with

    for each "looptokes"

    from: 0

    to: tokencount(textvariable, "|")

    sub of loop

    compare 2 variables

    tokenat(tokenat(textvariable, loopindex, "|"), 0 ,",")

    equals

    "multiplechoicetext" : action spawn questiontext, set text: tokenat(tokenat(textvariable, loopindex, "|"), 1 ,",") //Set question

    set questiontext instance variable awnser: tokenat(tokenat(textvariable, loopindex, "|"), 2 ,",") // Text instance variable now holds correct awsner

    set tempvariable: tokenat(textvariable, loopindex, "|") //use a temp to avoid loopindex issues in the next loop

    sub of compare

    for each loop to create the questions awnsers:

    from: 3 // First three entries were type, question and awnser

    to: tokencount(tempvariable, ",")

    action: spawn awnsertext, set text = tokenat(tempvariable, loopindex, ",") // sets the questions

    set awnsertext instance variable awnser: loopindex

    Onclick awnsertext

    compare 2 variables

    questiontext.awsner

    equals

    anwerstext.awnser

    action: awnser correct

    else: action: incorrect

    A bit advanced, but can work really well without any further extras.

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