Trivia Game - It works but it doesn't start again

Get help using Construct 2

Post » Thu Oct 29, 2015 4:11 pm

Hello everybody! I've been "playing" with C2 for a while now and I've done many tutorials, but I'm just a beginner and I don't know much about coding.

At this moment I'm trying to do a simple Trivia Game, and thans to differents tutorials I've made one as I want it, but I have some problems. You can see the basic form (without graphics) here:
This version is with 6 randomized numbers. It works once. After that it doesn't re-start.
https://www.dropbox.com/s/9c7m2ksoqss6c14/2015_10_29_Preguntas%20trivia_v2.capx?dl=0

This version is exactly the same but with 7 randomized numbers instead of 6. It works well and it re-start but it gets one void question because it has one more number that the Questions Array.
https://drive.google.com/open?id=0B6tni9RL-XLpN2d6RjRKX1NwcUk

The game works as follows:
1- It makes an Array with numbers between 1 and 6 randomized.
2- After that, it charges the questions from a txt file into another Array, considering I have a Variable that starts at 1 and with every answer add 1 to its value, loading the next question.
3- It checks the Answer and it gives a feedback with "Correct" or "Incorrect"
4- After all the 6 questions it goes to a new Layout called "End"
5- From "End" it goes to the first layout "Game". Is supposed to re-start the game but it doesn't work.

I've seen that if I put one more number to the Array with randomized numbers it works well, but the problem then is that I have one more index at this Array that I have in my Questions Array and I get a void question, without values.

I know I've done something wrong but as I'm just a beginner, I don't see it :oops:
Could anyone help me, please?
B
3
Posts: 4
Reputation: 183

Post » Thu Oct 29, 2015 4:33 pm

You should clear your array on start of layout.. (ArrayListaAleatoria)
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Oct 29, 2015 4:40 pm

Thanks!!! I've been trying for days to make it work and I didn't think about that.

Sorry for the mix Spanish-English by the way, I know is a bit messy lol.

Thanks!!!
B
3
Posts: 4
Reputation: 183

Post » Fri Oct 30, 2015 4:14 am

Here is a trivia template by James Quick, a Microsoft Technical Evangelist.
You might be able to learn from it, and its free.

James Quick's GitHub: Click the item you want and select "Raw" to download.

https://github.com/jamesqquick/Construct-2/tree/e9f155ff7527f724e5e558893c0c4f5b4568badd/Game%20Templates
Last edited by chrisinfinger on Sat Oct 31, 2015 6:59 am, edited 1 time in total.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
71
S
19
G
8
Posts: 640
Reputation: 9,701

Post » Fri Oct 30, 2015 9:43 pm

Thanks Chrisinfinger!

If you see my file you can guess I used this very trivia template as example to do my game.

The other one I think is very useful too! but the link to the *.capx file doesn't work... :(. Could you give a new link to download it, please?
B
3
Posts: 4
Reputation: 183

Post » Sat Oct 31, 2015 7:00 am

I changed the link above to his GitHub for all his cool templates, select one you want and choose "Raw" to download.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
71
S
19
G
8
Posts: 640
Reputation: 9,701

Post » Sat Oct 31, 2015 12:58 pm

Awesome! thanks a lot!
B
3
Posts: 4
Reputation: 183


Return to How do I....?

Who is online

Users browsing this forum: PratikIngle, RIDETHEPIG and 8 guests