Improve Quiz Game - Logic Needed

Get help using Construct 2

Post » Wed Feb 10, 2016 9:25 pm

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
B
3
S
1
Posts: 2
Reputation: 333

Post » Wed Feb 10, 2016 9:52 pm

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.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 787
Reputation: 3,786

Post » Thu Feb 11, 2016 1:02 am

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?
B
3
S
1
Posts: 2
Reputation: 333


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests