0 Favourites

# Improve Quiz Game - Logic Needed

• 3 posts
• 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!

• 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.