Improve Quiz Game - Logic Needed

  • Hello all! First post here, hopefully I'll get some feedback.

    Here's the link to the .capx:

    https://www.dropbox.com/s/fucvnobwogihu ... .capx?dl=0

    Press the space bar to shoot notes to select answers.

    I made this quiz game about two years ago, when I was just starting out with C2. I think the methods I used were fairly simple, and I want to think of a better way to do it, and improve upon it. Do you think I should be using an array? If so, how? Probably should be using functions for some of it. Is there a complete different way of approaching this that would be much easier or more logical?

    I also want to figure out a way so that every time it runs, the answers aren't always in the same order. Right now the answers for any question will always be : a = answer1, b = answer2, c = answer3, d = answer4. I want to to have it so that it randomly decides where each answer goes. Not sure how to do that though. My logic was to have a global variable generate a random number 1 through 4. and then based on that number have the answers order in various ways. However I was not able to make a global variable a random number.

    Thanks for you thoughts!

    Adam

  • Oh yes, you can do that a LOT easier.

    1) Texts could be spritefonts (or text objects, but those are trickier to handle in terms of positioning).

    2) Questions therefore could come from a project file, containing all your questions and answers. You would need to incorporate the possibiliy to add images from the question text, but that's very much doable (putting them into an array after loading the project file would be possible, but not necessary)

    3) randomizing the order of 1-4 could be done by a shuffling an array containing the numbers 1 - 4 (knuth shuffle)

    4) you have many duplicate sprites in the a, b, c, d, you only need them once

    You'd end up with something, where you don't need to add any events just to add a new question. You'd only need to add your images in the questions and answer text, that you want to use and update your questions in the project file.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I want the text to be images because I don't want to have to worry about the user not having the font. What do you mean by knuth shuffle? Is that a plug-in? I agree I have too many duplicate a,b,c,d that I could cut out.

    What do you mean about adding images from the question text?

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