Trivia Game

0 favourites
From the Asset Store
five golem elements Sprites Sheet.Best for enemy or villain game characters.
  • Hi everyone!

    I am struggling to set up a simple trivia game. I am struggling with Text Boxes and Text objects and how to set local and global variables.

    I assume the Text Object where a Question would be held would have instance variables with actual questions.

    I just need an example of how to then pass a value from the Text box into a global variable and do an if, then check and display correct or not.

    Finally a randomizer function to mix up the question order on each play.

  • I have something working, but the tracking questions already asked is a bit buggy. Let me fix that either tonight or tomorrow (my sense of logic is out the window right now) and I'll put it up for you. If you want as is, let me know.

  • That would be great! I will take either. I appreciate the effort and look forward to seeing it! It is much appreciated as I am a new designer and want to thank you much.


    Hope you can understand most of it. I wouldn't setup a trivia game like that since there'd probably be well over 100 questions, but just did it that way to show you how arrays work for something like this. I'll probably look into getting AJAX to load a questions file and go from there, once the jumbling part is fixed so it doesn't ask the same questions.

  • To explain quickly..

    Questions array holds the questions (index 0 - 4)

    Answers array holds the answers (array index 1 - 4, question index)

    Answers array (0, question index) holds the correct answer which is referred to later on.

    TrackQuestions array stores each question's array index when a question is asked. This should be looped through to make sure the current ranom question isn't already asked but is flawed. I tried different methods so the code looks a mess there. Just ignore that. I'll fix it when I don't have so much on the go ;p

    The textbox that shows WRONG and CORRECT, also shows debugging info in the QuestionsTracked array.

  • I tried to open the Capx file and it wont open as it says its from a newer version greater than r114.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Download r115.

    I've never had a problem with it, even if it is beta. You can install to a different directory to the stable release anyway.

  • Thank you again! The new version loaded the project. I will check it out and I very much appreciate your help! Is there a way to create a global variable to make a score?

    I assume I can add up to as many questions as long as I dont go over 100 events?

  • No problem!

    Yep. Adding questions won't affect how many events you have since storing in the array is actions, not events ;) Although I wouldn't want to be you adding questions in that manner. I'll get AJAX loading done probably tomorrow as it's a simple thing really, but still takes a bit of time. It'll make it much easier to add your own questions in a text file. I wouldn't mind having an engine like this anyway ;)

    You can add a score very easily.

    global variable score = 0

    Then where it changes the text box to "CORRECT!" just add 1 to the score and go from there.

  • Your very helpful and I again thank you! If i can offer something back to you since your developing the ajax version with the score function. I write instrumental music, you are free to use any of it license free in your work. The entire catalogue is at and I can email you the tracks you like.

  • Ah nice one. I'm after a bit of music as it happens. I'll have a gander tomorrow. Don't suppose you have any retro sounding stuff? Like chiptune-ish?

  • There is quite a bit that I have there on that site most is made for commercial licensing however I do have other material. You can sample on the site and let me know what you like and I will send your way.

    As far as retro, its hard to say I have a particular track in that exact genre type however some of the older tracks have some of those aspects.

    I wanted to design for facebook as well however I cant find any affordable space as you need SSL https and a dedicated IP etc all. That part is frustrating.

    I appreicate you making an ajax example as I woudl like to make a trivia game. I made my first Construct game under the kevinwars1.0 folder. Its a very simple basic shooter game.

    I wish there was a detailed tutorial on the ghost shooter game as well. i would love tosee how that works.

  • Yeah I had a brief listen to a couple of randomly selected tracks and they weren't what I'm after, but I'll give every one a listen to tomorrow. If you know about the demoscene, you'll know what I'm after ;) Hopefully I'll find something that fits. Thanks for the offer either way!

    Don't know about Facebook as I've never even attempted anything for that platform. You need all that crap for that? Probably a good thing I'm not fussed then ;p

    The ghost shooter tutorial version is well commented. You shouldn't have any problems understanding how it works from that.

  • Oh im sorry about the tracks. I will take another good look at the ghost shooter tut.

    I again appreciate your help on the trivia i look forward to the ajax example.

  • No worries. I'm after a particular style so am picky ;p

    Here's the AJAX version with non repeating questions fixed.


    I learned quite a bit myself doing that ;)

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