0 Favourites

Global Variables?

  • hi there, right, I'm just going to state some information that I believe to be correct, if I'm wrong, PLEASE correct me as im rather stuck :(

    Im making a quiz game, So i think that my event sheet needs to look something like this:

    -Global Variable=0

    -Question 1 group

        -System - Compare Variable to 0

        -Set Button Text info

        -Answer Button 1 - On click - +1 to global variable + Set text - Correct

        -Answer Button 1 - On click - +0 to global variable + Set text - "Nope, Try again!"

        -Answer Button 1 - On click - +0 to global variable + Set text - "Nope, Try again!"

        -Score Count code

    -Question 2 group

        -System - Compare Variable to 1

        -Set Button Text info

        -Answer Button 1 - On click - +1 to global variable + Set text - Correct

        -Answer Button 1 - On click - +0 to global variable + Set text - "Nope, Try again!"

        -Answer Button 1 - On click - +0 to global variable + Set text - "Nope, Try again!"

        -Score Count code

    and so on...

    So in order for me(Or the user) to access the next group of questions I'll have to set the correct answer button to add +1 to the global variable, so then the global variable's total would be 1 and no longer 0, so the questions from the second group would show and the others would not?.... I think..

    I feel like I'm missing something here, because when I try this with my project, I cant get it to work, buttons have a delay, text wont change ect.... :( Any answers are heavily appreciated!

    • CURRENT DRAFT - Project for viewing pleasure -

    https://www.dropbox.com/l/b7vVDgsW988ExW4BJfuYI8

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • https://dl.dropboxusercontent.com/u/3954039/ZZZ%20TEST.rar

    Set the events of each question as a sub-event. Also use the "trigger once while true" action for events that don't need to happen every frame, such as changing the text on the buttons

  • Thankyou!!!!!!!!!!!!!!

    7Soul you've cured my problem, explained it to me and given me an example so I know exactly how it works! - Perfect!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
102 6,399
Ashley's avatar
Ashley Construct Team Founder
Unread hot topic
64 12,940
trollface's avatar
trollface
Unread hot topic
44 14,813
R0J0hound's avatar
R0J0hound