How do I set up a database to display random questions?

Get help using Construct 2

Post » Tue Sep 29, 2015 6:15 pm

Pretty new to construct 2 and i am trying to make an educational game for a school project. I want to have a textbox in game that shows a question for a certain amount of time, specifically about verbs. The player then has to select the correct verb form. Ideally the question would be a random question picked out of a database of questions.

The problem is i have no idea how to implement this in C2 and the tutorials i am finding online about databases i find do not really help me with this particular thing. Is there someone that knows how this works and could maybe explain it to me? :)
B
3
Posts: 3
Reputation: 181

Post » Tue Sep 29, 2015 8:19 pm

...just search forum for :Trivia or Quiz and Array..

How do I

simple quiz game.capx
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Tue Sep 29, 2015 9:21 pm

In the Simple Quiz Game example, can it be changed to allow more than one correct answer per question?
B
19
S
3
Posts: 62
Reputation: 1,764

Post » Wed Sep 30, 2015 1:39 pm

@Minoterrae
you mean like...each question has two(three;four) correct answers.?
..or..
....the first question has two correct answers;
....the second question has three correct answers;
...the third question has one correct answer
..etc..?
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Wed Sep 30, 2015 3:09 pm

Well, each particular question would be different. But an example would be:

Who Was A U.S. President?

Thomas Jefferson, George Washington, Nathan Hale, Patrick Henry

Here there would be more than 1 correct answer.
B
19
S
3
Posts: 62
Reputation: 1,764

Post » Wed Sep 30, 2015 5:23 pm

@Minoterrae
..maybe you cant build something like this:

FindAll.capx

Image
Image
Last edited by korbaach on Wed Sep 30, 2015 8:16 pm, edited 1 time in total.
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Wed Sep 30, 2015 7:42 pm

Terrific example!
B
19
S
3
Posts: 62
Reputation: 1,764

Post » Thu Oct 08, 2015 6:43 pm

Korbaach,

In the Find All example you did, can you tell me what the following parameters mean? "c2array"":true,""size"":[8,6,1]

The 8 is the number of questions, but what is the 6 and 1? Also, what is the string length? I put in a couple of my own answers but they were too long to be shown.

Thanks,
B
19
S
3
Posts: 62
Reputation: 1,764

Post » Fri Oct 09, 2015 12:38 am

Minoterrae wrote:.... what the following parameters mean? "c2array"":true,""size"":[8,6,1]
The 8 is the number of questions, but what is the 6 and 1?


Array

Image


One-Dimensional Array (5,1,1)

Image

Two-Dimensional Array (2,2,1)


Image
Array=Array2
..if you use "Load from JSON string" ..you can set size & data in only one action...

Array X=5 ; Y=6 ; Z=1
Image
(..in example I use Two-Dimensional Array(8,6,1) similar to this...)

Arrays are zero based ..just like Sprite animation (first frame have index 0)


I advise you to download this little program Array contents editor

Image
set X to number of questions as you want...Y=6 (Rows) ; Z=1

and now you can fill the slots
Image
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Thu Oct 15, 2015 11:56 pm

I am enjoying making changes to Findall.capx, but when I choose a wrong answer, how could I get C2 to also highlight what the correct answer should have been?
B
2
Posts: 2
Reputation: 154

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests