How do I save time per question?

0 favourites
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • In my timer after you press submit it should stop the timer and save the current time somewhere. At last it should show the time for each question. What is the 'somwhere' where it could hold all this and how would you save it?

  • You could store them in the Array based on index (order) of each question.

    If you only need to show timer for 1 question then you should add local variable (static) instead.

  • You could store them in the Array based on index (order) of each question.

    If you only need to show timer for 1 question then you should add local variable (static) instead.

    How would I save t. Is there an expressio?

  • 1. Add temporary Array for your quiz. At the start of your quiz, set size for this Array:

    X - set to how many question you have in the current quiz

    Y - set to how many variables you want your question to store. Let's say you only need 2: Result & Timer. Y would be equal to 2 then.

    Your first Question would be equal to 0, second to 1, third to 2 and etc.

    2. Add static local integer variable (ID) which saves current index. 0 by default.

    As your whole quiz starts from the beginning, variable must be set to 0.

    It should be in the same Group as your other functions for the quiz which should have access to it.

    You could use global integer variable for that too. Whatever you find appropriate.

    3. Add local boolean variable (Answer) inside your "checkQuestion" function. If player answered correctly it would set there to True (1).

    4. In the very end of your "checkQuestion" function, but before Timer has stopped:

    1. SAVE RESULT. Set XY value for temporary Array:

    X - ID variable

    Y - Answer variable

    2. SAVE TIMER. Set XY value for temporary Array:

    X - ID variable

    Y - Timer.TotalTime

    3. Add 1 to ID variable by the end of your "checkQuestion" function.

    I hope I explained it well enough -_-

  • 1. Add temporary Array for your quiz. At the start of your quiz, set size for this Array:

    X - set to how many question you have in the current quiz

    Y - set to how many variables you want your question to store. Let's say you only need 2: Result & Timer. Y would be equal to 2 then.

    Your first Question would be equal to 0, second to 1, third to 2 and etc.

    2. Add static local integer variable (ID) which saves current index. 0 by default.

    As your whole quiz starts from the beginning, variable must be set to 0.

    It should be in the same Group as your other functions for the quiz which should have access to it.

    You could use global integer variable for that too. Whatever you find appropriate.

    3. Add local boolean variable (Answer) inside your "checkQuestion" function. If player answered correctly it would set there to True (1).

    4. In the very end of your "checkQuestion" function, but before Timer has stopped:

    1. SAVE RESULT. Set XY value for temporary Array:

    X - ID variable

    Y - Answer variable

    2. SAVE TIMER. Set XY value for temporary Array:

    X - ID variable

    Y - Timer.TotalTime

    3. Add 1 to ID variable by the end of your "checkQuestion" function.

    I hope I explained it well enough -_-

    Woah, this is alot. May take some time to throughly read. Thanks! I'm sure this'll work.

  • **Little clarification

    1. SAVE RESULT. Set XY value for temporary Array:

    X - ID variable

    Y - 0

    Set: Answer variable

    2. SAVE TIMER. Set XY value for temporary Array:

    X - ID variable

    Y - 1

    Set: Timer.TotalTime

  • 1. Add temporary Array for your quiz. At the start of your quiz, set size for this Array:

    X - set to how many question you have in the current quiz

    Y - set to how many variables you want your question to store. Let's say you only need 2: Result & Timer. Y would be equal to 2 then.

    Your first Question would be equal to 0, second to 1, third to 2 and etc.

    2. Add static local integer variable (ID) which saves current index. 0 by default.

    As your whole quiz starts from the beginning, variable must be set to 0.

    It should be in the same Group as your other functions for the quiz which should have access to it.

    You could use global integer variable for that too. Whatever you find appropriate.

    3. Add local boolean variable (Answer) inside your "checkQuestion" function. If player answered correctly it would set there to True (1).

    4. In the very end of your "checkQuestion" function, but before Timer has stopped:

    1. SAVE RESULT. Set XY value for temporary Array:

    X - ID variable

    Y - Answer variable

    2. SAVE TIMER. Set XY value for temporary Array:

    X - ID variable

    Y - Timer.TotalTime

    3. Add 1 to ID variable by the end of your "checkQuestion" function.

    I hope I explained it well enough -_-

    variables for what? (1.Y)

  • For your save.

    X (any) - is index of your question

    Y (0) - Player answered right or wrong. Stores boolean: 0 or 1

    Y (1) - Timer in which Player answered the question

    Also don't forget that On Timer 'Q' would also have to trigger checkQuestion function otherwise if your Timer run out your array would store 0 (because Timer didn't run)

  • **Little clarification

    1. SAVE RESULT. Set XY value for temporary Array:

    X - ID variable

    Y - 0

    Set: Answer variable

    2. SAVE TIMER. Set XY value for temporary Array:

    X - ID variable

    Y - 1

    Set: Timer.TotalTime

    Should the value be what you were saying for XY (Set: ANswer Variable etc.)

  • For your save.

    X (any) - is index of your question

    Y (0) - Player answered right or wrong. Stores boolean: 0 or 1

    Y (1) - Timer in which Player answered the question

    Also don't forget that On Timer 'Q' would also have to trigger checkQuestion function otherwise if your Timer run out your array would store 0 (because Timer didn't run)

    But it wouldnt be able to triggger because only when you press submit will it trigger to call checkQuestion function

  • I see.

    I thought your Questions must have been answered in Fixed time. People sometimes do that in Quiz games.

    Seems like you only need Timer to measure time. Then in SetQuestion write instead of time system expression: infinity

  • Try Construct 3

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

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

    I thought your Questions must have been answered in Fixed time. People sometimes do that in Quiz games.

    Seems like you only need Timer to measure time. Then in SetQuestion write instead of time system expression: infinity

    I'm sorry I dont understand. Change the once as infinity?

  • No. Duration.

  • No. Duration.

    It just got stuck at 00:00

  • Show event which changes text to current time.

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