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

0 favourites
  • 7 posts
From the Asset Store
five golem elements Sprites Sheet.Best for enemy or villain game characters.
  • 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.

    dropbox.com/s/9c7m2ksoqss6c14/2015_10_29_Preguntas%20trivia_v2.capx

    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.

    drive.google.com/open

    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

    Could anyone help me, please?

  • You should clear your array on start of layout.. (ArrayListaAleatoria)

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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

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

  • I changed the link above to his GitHub for all his cool templates, select one you want and choose "Raw" to download.

  • Awesome! thanks a lot!

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