Advice needed for quiz game

This forum is currently in read-only mode.
From the Asset Store
Guess the sound Quiz is an amazing and innovative app for kids to learn the different animal sounds.
  • I want to create a quiz game.Here is how i want to do it.I must type the correct answer into the text box and after i typed the answer into the text box i have to click a button.After i pressed the button the game must show me if the answer is correct or not.Please tell me how to do this.Im creating a maths game for my son , please help.

  • If it's just simple maths questions like addition and multiplication then it'd just be a case of taking the values and comparing the expression to the value that is in the text box when the button is pressed.

    I've not got construct installed atm so can't really throw anything together but I imagine this is really simple to do if you use a couple of text objects to display your numbers... but of course it depends how complex the whole thing needs to be, a more detailed description of what you have in mind will be useful to anyone who might help

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You should have an array, INI, or hashtable of the correct answers. More specifically, the key words for the answer. Then when the user inputs their text and clicks the button you then parse the input text and check the text against your stored right answer.

    For example, for the question, "What is the longest river in the world?" The answer, Nile will be stored in some type of data structure mentioned previously that is indexed to the question. When the user types their answer, use the text manipulator object to grab each input text and compare to "Nile". That way answers like, "the Nile" will be correct as well.

    You can also do this with Python and regular expressions but I think you might be able to get by fine with just Construct objects.

    Edit: Oh.. for math then just compare the integers etc...

  • I like Construct's TokenString system expressions for things like this. They are just string variables with different fields separated by some character or string. In this case, I'd use a TokenString with NewLine separators, where each field is another TokenString with a '|' separator, containing each question and answer pair.

    I made a quick example of such a method, here:

    http://dl.dropbox.com/u/5868916/MathQuiz1.cap

    It's not commented, and quickly written, but it should get the idea across. It's fairly dynamic, and can help keep the number of events down. If anything in it sparks your interest, and you have any questions, I'll check back when I have more time.

    Basically, you can just double-click the text object above the layout, and enter each 'question|answer' pair on a new line in the popup editor, then run it to test it out. You can end the question list with a NewLine or 'END'.

    Also, You can also just read 'enter key pressed' instead of using a button if you like.

    It assumes all answers are numbers, and converts the strings to floating-point numbers. This can be a bit tricky, if you work with floats. This example uses the system expression FormatDecimal to round off the numbers, but I'm not sure that it works as I would expect it to. May just have to specify that all answers follow a certain format at the beginning of the quiz...

    The data structures that scidave mentioned can also be used in much the same way, though setting them up may require more steps.

  • Wow! Thanks Silent that's exactly what i wanted.

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