How do I make trivia game ?

  • How do I make trivia game with so many question in text an the answer of the question is in image, then I can random my question and my answer.

    If you know it, please help me. I will gladly sent my project.campx

  • So, I have question again if I have an quiz game, example :

    Who is the first presiden of Indonesia Republic ?

    A. Habibie

    B. Soekarno

    C. Jokowi

    I used a file text as an array for my question. And an image for my answer, please tell me how do I make it ?!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Follow some tutorials and learn C2 ; this is a very general sort of question and suggests a lack of coding experience. Don't run before you can walk.

  • Dear paulscottrobson,

    well thanks for the suggestion, but right now I have to run you know, cause it's for my project

  • Yeah, I know. But following a few tutorials or a course will get you there more quickly. People sometimes jump into these things planning to rewrite Super Mario World, get frustrated and give up. It's much better to start with "Pong".

    Incidentally, I would check that you can use C2 for your project if this is for a course.

  • paulscottrobson, I hope you know which one of the step which is better for making a trivia game. I want my question in a text and my answer is in an image(spirite)

  • Well, I would look at the Sprite / Load Image from URL stuff

  • Simplest way I can think to do trivia is build an array. With columns and as many rows as you need. You will need to either manually design the array with each item when the game starts but since this is potently a large array writing a JSON file would be simplest. If you are using windows a simple notepad file saved as UTF-8 and named like "MyTriviaList.json" Then in C2 right click on ProjectFiles and add new and save the .json file there.

    The JSON looks much like this

    {"c2array":true,"size":[2,4,1],"data":[
         [["This is the first question"],["A: This is answer A"],["B: This is answer B"],["C: This is answer C"]]
         [["This is the Second question"],["A: This is answer A"],["B: This is answer B"],["C: This is answer C"]]
    ]}
    [/code:ds556wwz]
    
    Then inside C2 use AJAX to load project file then on complete load your array from JSON using Ajax.LastData. Form then its more art and personal choice of design and I can not help you there.
    
    Best of luck
    
    ps "size":[row,column,depth] make sure that is the correct size or it will not work.
  • CrazyVulcan, thank for the answer I will try it

  • CrazyVulcan

    hey I made this code

    "{""c2array"":true,""size"":[4,6,1],""data"":[[[""Click on the Blue""],[""Red#0""],[""Green#1""],[""Blue#2""],[""Yellow#3""],[2]],[[""Click on the number Two""],[""Two#4""],[""One#5""],[""Three#6""],[""Four#7""],[4]],[[""Click on the Star""],[""Circle#8""],[""Triangle#9""],[""Star#10""],[""Square#11""],[8]],[[""Click on the Purple""],[""Circle#12""],[""Triangle#13""],[""Star#14""],[""Square#15""],[13]]]}"

    the problem is, that the question number 4 doesn't want to appear. It's just showing 3QA

    please help me

  • CrazyVulcan

    hey I made this code

    "{""c2array"":true,""size"":[4,6,1],""data"":[[[""Click on the Blue""],[""Red#0""],[""Green#1""],[""Blue#2""],[""Yellow#3""],[2]],[[""Click on the number Two""],[""Two#4""],[""One#5""],[""Three#6""],[""Four#7""],[4]],[[""Click on the Star""],[""Circle#8""],[""Triangle#9""],[""Star#10""],[""Square#11""],[8]],[[""Click on the Purple""],[""Circle#12""],[""Triangle#13""],[""Star#14""],[""Square#15""],[13]]]}"

    the problem is, that the question number 4 doesn't want to appear. It's just showing 3QA

    please help me

    I don't suppose you would mind linking a Dropbox link to a .capax of what you are trying to do. From your example I am not really sure what you are trying to do or how you plan to use it in your game.

    Going back to my example in a game you would have your array and your screen will have four text boxes. You will also need a global variable to sort though the array. Just when you want the next question use "Set Value = random(0,10)" and then use that to call the needed row in your array.

    Then it is a matter of changing the text of each text object to the corresponding section of the array. You will also need to run a For Each loop where you "row# = Global Variable"

    If I find the time I will make a demo .capax to show you but it may be a day or two till I get to it.

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