Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Forum

official community forum of gametemplates.itch.io · By GameTemplates

quiz template for Gdevelop

A topic by PNVG created Jul 13, 2022 Views: 175 Replies: 2
Viewing posts 1 to 2

Hi, Can you tell me please, how can I had questions and answers in your cool quiz template for Develop?.

Thanks.

(1 edit)

Hi.

The questions and answers are stored inside a structure variable "quizextension_questions"

Questions are sorted in to 3 difficulty

  • "quizextension_questions.easy"
  • "quizextension_questions.medium"
  • "quizextension_questions.hard"

Following the difficulty you set the number of the question. For example

  • "quizextension_questions.easy.1"
  • "quizextension_questions.easy.2"
  • ...etc

There are total 7 easy questions in the example. Each question has 7 properties. Title, A,B,C,D,Solution,Picked

For example to add one more easy question you need to set the following structures :

  • quizextension_questions.easy.8.Title = "Title of new easy question" --note the number 8, meaning it is the 8th question
  • quizextension_questions.easy.8.A = "Answer A"
  • quizextension_questions.easy.8.B = "Answer B"
  • quizextension_questions.easy.8.C = "Answer C"
  • quizextension_questions.easy.8.D = "Answer D"
  • quizextension_questions.easy.8.Solution = "A" --the letter of the correct answer, in this case it is "A"
  • quizextension_questions.easy.8.Picked = 0 --it is always default to 0, the engine use this to flag questions if they were picked or not to avoid picking the same question again.

The  questions are initialised inside the InitializeQuizGameEngine function in QuizExtension Behavior.

Sorry it is a tedious manual design, not very effective to be honest and also out of date, I would not recommend doing this for hundreds and thousands of questions. This is an old example from a time when there was no Yarn dialog system and arrays and local file system available  in GDevelop. You may want to use one of those features instead of this tedious structure variable solution.

Hope it helps.

Thank you sir.