Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Taps (or clicks) per Minute

Discussion in 'Scripting' started by grossimatte, Sep 29, 2018.

  1. grossimatte

    grossimatte

    Joined:
    Mar 15, 2013
    Posts:
    43
    Hello Everyone,
    How can i determine at which BPM (beat or touch or click per minute) is the user tapping on the screen at in a C# script?

    Thanks!
     
  2. BPPHarv

    BPPHarv

    Joined:
    Jun 9, 2012
    Posts:
    318
    There's two way I can see to skin this cat.

    #1 Compare this click time to last few click times to calculate the difference in time between individual clicks. Divide one minute by the time you calculated. This will give you the instantaneous clicks per minute if the user clicked the button consistently (i.e steady click rate). I'd use this more like a power up button click measure. Has the user pressed the button repeatedly fast enough for a given number of clicks?

    #2 Make a list to store click times. Add click times to the list as user enters them. Remove clicks older than one minute. Divide one minute by the number of clicks in the list. This will give you a historical clicks per minute regardless of the cadence the user clicked (i.e clicking on the mouse at once at one second, waiting, clicking at 10,10.1,10.2 seconds would give you 4 clicks per minute).
     
  3. grossimatte

    grossimatte

    Joined:
    Mar 15, 2013
    Posts:
    43
    Thanks for your reply BPPHarv,
    What i am trying to achieve is to calculate the average clicks per minute, not the effective ones.

    If the player clicks the mouse 4 times in 3 seconds, i want to average how many clicks that would be in a minute.

    I believe the first option is the correct one!?
     
  4. Cpstester

    Cpstester

    Joined:
    Sep 17, 2021
    Posts:
    3
    What did you ask about the Click Per minute game?
     
    Last edited: Sep 20, 2021
  5. VacerX

    VacerX

    Joined:
    Jun 25, 2021
    Posts:
    1
    The clicks per second are always better than seconds...