I'm doing a quiz, where I need to have a multiple choice answers and in two questions I need to have two correct answers. This is my code, and I don't know what I need to do next. I have two problems, first, when I click on right answer it says that is wrong and second problem is that i can't choose multiple answers.
Based on your blocks
| You can’t tick more than one box. | Every CheckBoxX.Changed
handler forces the other two check-boxes to false
, turning the three boxes into radio buttons. |
Do these four easy fixes
- Let more than one box stay ticked
- In every CheckBox-Changed block, delete the two blocks that untick the other boxes.
(Those lines turn the boxes into radio buttons.)
- Keep a list of what the player ticks
- Make a global list called picked.
- When a box is ticked, add its text to picked.
- When a box is unticked, remove its text from picked.
- Store the right answers as lists too
- Put each question’s correct answers into a little list, even if there is only one right answer.
- When “Next” is pressed, compare the two lists
- Get the right-answer list for the current question.
- The player is right only if:
- both lists are the same length, and
- every item in the right list is also in the picked list.
- After checking, clear picked and untick all boxes, then show the next question.
That’s it: boxes can stay ticked, and questions with one or two correct answers will be graded properly.
(added to FAQ)
1 Like