How do I make a multi-answer quiz?

  • applern You haven't included a link to your app - post it up and I'll take a look.

    Sorry, Here. drive.google.com/file/d/1v59w-puMMZF4W2h8CaXZsB-NTxo3_YnL/view mekonbekon

  • Here you go:

    dropbox.com/s/8rxd49g89k9zyxo/quizApplern.c3p

    The score wasn't being tallied because the "selected" boolean was being used to check for a correct answer but it wasn't being set anywhere. However, you don't need to use that boolean any more because you can just check if the answer boxes are ticked.

    I've tidied up a few other things and added comments to explain the changes.

    A couple of suggestions for keeping healthy code:

    1) Keep an eye out for events that are unnecessarily running every tick - they can end up slowing things down. There were a few that needed to be nested under a triggered event.

    2) Avoid repeating triggers with different conditions e.g. On button pressed, do action A; On button pressed, do action B. Instead just have one "On button pressed" trigger, then action A and action B as sub events.

  • Here you go:

    https://www.dropbox.com/s/8rxd49g89k9zyxo/quizApplern.c3p?dl=0

    The score wasn't being tallied because the "selected" boolean was being used to check for a correct answer but it wasn't being set anywhere. However, you don't need to use that boolean any more because you can just check if the answer boxes are ticked.

    I've tidied up a few other things and added comments to explain the changes.

    A couple of suggestions for keeping healthy code:

    1) Keep an eye out for events that are unnecessarily running every tick - they can end up slowing things down. There were a few that needed to be nested under a triggered event.

    2) Avoid repeating triggers with different conditions e.g. On button pressed, do action A; On button pressed, do action B. Instead just have one "On button pressed" trigger, then action A and action B as sub events.

    In my version the correct for 1st Q the correct answer is 3, but for yout version its all of them. This keeps happening for multiple questions

  • If you don't want answers that havn't been checked and are incorrect to display a tick set those ticks invisible in the checkQuestion function.

  • If you don't want answers that havn't been checked and are incorrect to display a tick set those ticks invisible in the checkQuestion function.

    I dont understand

  • In the updated file I provided, events 16 to 21 in function checkQuestion check if an answer is correct and if it is selected:

    If it is correct & selected (event 17) or incorrect & not selected (event 21), spr_tickCross for that answer displays a tick.

    If it is correct & not selected (event 18) or incorrect & selected (event 20), spr_tickCross for that answer displays a cross and the local number n is increased by 1.

    At the end of the function if n = 0 (i.e. no correct answers missed or incorrect answers selected) then the score is increased by 1.

    If you only want spr_tickCross to be shown for selected answers then set the spr_tickCross in events 18 & 21 to invisible.

    If want spr_tickCross to be shown for selected answers and missed correct answers then set the spr_tickCross in event 21 to invisible.

    Whatever you choose, it would be best to communicate to the user all the correct answers and incorrectly marked answers in some manner - perhaps reveal an icon next to the correct answers or change the text colour?

  • I've updated the project again to show what I mean - grab latest:

    dropbox.com/s/8rxd49g89k9zyxo/quizApplern.c3p

  • I've updated the project again to show what I mean - grab latest:

    https://www.dropbox.com/s/8rxd49g89k9zyxo/quizApplern.c3p?dl=0

    So I set spr_TickCross to invisible in event 21 but it didnt show wrong sprite. Here is the code

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Upon submitting, the current set-up will display:

    1. Correct answers in green text (regardless of whether or not they've been selected)

    2. A tick next to correct selected answers

    3. A cross next to incorrect selected answers

    If that's not the desired output, please let me know what you want to display for the following use case scenarios:

    1. Correct answer selected

    2. Incorrect answer selected

    3. Correct answer not selected

    4. Incorrect answer not selected

  • Upon submitting, the current set-up will display:

    1. Correct answers in green text (regardless of whether or not they've been selected)

    2. A tick next to correct selected answers

    3. A cross next to incorrect selected answers

    If that's not the desired output, please let me know what you want to display for the following use case scenarios:

    1. Correct answer selected

    2. Incorrect answer selected

    3. Correct answer not selected

    4. Incorrect answer not selected

    To clarifY:

    On submit pressed

    All correct answers green whether or no they were selected (optional)

    Tick mark next to all correct answers whether or no they were selected

    Cross mark next to all wrong answers whether or not they were selected.

  • If you want all of the ticks/crosses to show then don't set any to invisible and just set the tick/cross on the conditions that test if the answer is correct/incorrect:

    If you do that then you won't need to set the text to green as the tick is already displaying the correct answers.

    Bear in mind that it won't be as obvious to the user how you're scoring the answers; ticks and crosses are typically used to mark user choices rather than flag the correct answers so it may be difficult to discern between a tick indicating a correct answer or a correct selection, especially when there are multiple correct answers.

  • If you want all of the ticks/crosses to show then don't set any to invisible and just set the tick/cross on the conditions that test if the answer is correct/incorrect:

    If you do that then you won't need to set the text to green as the tick is already displaying the correct answers.

    Bear in mind that it won't be as obvious to the user how you're scoring the answers; ticks and crosses are typically used to mark user choices rather than flag the correct answers so it may be difficult to discern between a tick indicating a correct answer or a correct selection, especially when there are multiple correct answers.

    Thank you! It all makes sense now. I feel bad asking you so can you direct me to a forum that helps in restart ing arryas?

  • I'm not sure what you mean by "restarting arrays".

  • I'm not sure what you mean by "restarting arrays".

    So You know the restart button on the 'End' layout? When you press that it should go back to Quiz layout and back to a qUESTION 1 Also what if The person presses submit and no answers were checked? It should be wrong.How to code?

  • In eEnd reset the global variables:

    + Touch: On tap gesture on Restart

    -> System: Reset global variables to default

    -> System: Go to Quiz

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