Building a basic quiz

Hi,

I’m new to Corona and I’m trying to create a basic quiz. 

I want to have:

  • a start screen
  • 10 question screens each with: 1.  a text question 2. four answer buttons (one is correct)
  • an exit screen that displays the score out of 10

My questions are: should I use a different scene for each question, start and exit screens. If so, how can I access a table (holding the questions and answers) from each scene?

Should I not use scenes?

thanks for any help,

D :slight_smile:

I would have three scenes: Start, Quiz, Results.

There is a programming concept called DRY - Don’t repeat yourself.

If you did separate scenes for each question, you would be creating the same display objects over and over. If you decide later you want to change some aspect, you have to change it 10 times in 10 different files. Now if each question/answer page is radically different, then obviously different scenes would make sense.

With a single game scene you can have your table of questions and answers and have a “next question” or “submit” button that would score that question then simply change the values of the various display.newText()'s to their next value. Something like:

question.text = questionlist[i].question

answer1.text = questonlist[i].answer1

etc.

Thanks,  that really helps.

I would have three scenes: Start, Quiz, Results.

There is a programming concept called DRY - Don’t repeat yourself.

If you did separate scenes for each question, you would be creating the same display objects over and over. If you decide later you want to change some aspect, you have to change it 10 times in 10 different files. Now if each question/answer page is radically different, then obviously different scenes would make sense.

With a single game scene you can have your table of questions and answers and have a “next question” or “submit” button that would score that question then simply change the values of the various display.newText()'s to their next value. Something like:

question.text = questionlist[i].question

answer1.text = questonlist[i].answer1

etc.

Thanks,  that really helps.