How do I to get the average time of clicks

0 favourites
  • 7 posts
From the Asset Store
Time rewind like in "Braid". Choose objects that will be affected by time rewind
  • I need to register the average time a player takes to click a several sprites (for example: a image will be appear 10 times and I need to know how much time (ms) the player takes to click on each of them). So, I'll need to register this time and get the average after to show when he's finishes the interaction. Could anyone help me? Thanks.

  • You can use the "dt" (delta time) expression to get the amount of time elapsed since last tick. Add "dt" to a variable on tick, and when the button is pressed, get the value in the variable and put it in a list of recorded times, and then set the time keeping variable back to 0. At the end, you take the average by adding all the times in the list together, then dividing by the number of times in the list. So you would be dividing by 10 after adding all the times together.

    Alternatively you can also use Timers to record how much time has passed. Instead of adding delta time every tick, you could set a timer to execute every 0.1 seconds, and add 0.1 to the time keeping variable. This would be more optimal as you're not doing something every tick, only every 0.1 seconds, however this would be accurate only to a tenth of a second. You could decrease the timer interval to increase accuracy.

  • You can use 'wallclocktime' and just subtract the last value from the current value. You don't need to keep track of the time directly, just store that time on a click and use that as a reference on the next click.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can use 'wallclocktime' and just subtract the last value from the current value. You don't need to keep track of the time directly, just store that time on a click and use that as a reference on the next click.

    That's a good solution, I wasn't aware of "wallclocktime".

    To add to that, I would suggest you store the time when the next button spawns, rather than on click in case there is a delay between buttons.

  • Thank you, guys.

    One doubt blackhornet: if I use "wallclocktime", I'll need to get the time when the image1 appear, get it again on click and subtract these two values after, get the time again when the image2 appear ...., but how can I get the average time when the interaction stop?

  • You still need to store each difference. Use an Array.

    Edit: Or, keep a running total and divide by 10 after ten clicks.

  • Edit: Or, keep a running total and divide by 10 after ten clicks.

    Nice. Thank you.

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