How do I count rapid clicks?

0 favourites
  • 4 posts
From the Asset Store
Be quick and count the cards and choose the right number!
  • Im creating a game that has a sort of "Cookie Clicker" feature but the counter variable (clickCount = ClickCount +1) does not keep up with the rapid clicking. Is there any way to make the click count more representative or accurate of the actual clicks? Thank you in advance.

  • Try Construct 3

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

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

    unless you can click faster than 60 times a second, the counter should have no problem keeping up. Usually the computer spends most of its time waiting for the user...

    I would have to see your code, but maybe it is not counting some - because it thinks they are double clicks, or some other event is blocking the count.

  • a solution would be to keep track of the time between clicks and enable clicking if its around dt time which is basically every 0.15 miliseconds, any click faster than .1 milliseconds shouldn't count, as cookie cliker games are very intesive when u will have a lot of autoclicks happening + the clicks u do.

    so variable lets call it trackclicktime

    everytick add to trackclicktime 0.01

    on tap if trackclicktime greater or equal dt set clicked to true. or add 1 to clicks.

    on tap set trackclicktime to 0

    that way you avoid cheats also.

    this solution won't make the clickcounter be working faster, but will be accurate(and close to frame dependency... for more accurate 60/fps calculation u compare the trackclicktime to (60*dt) ) and work everytime as each click must be at 0.1 -0.15 apart from each other.

  • With very rapid clicking how do you even count it to know whether it is accurate. You may think you've clicked 4 or 5 times really quickly when in reality you've only clicked 3 times. It is much easier to make this mistake than you think. Alternate guitar picking is a great example of this. When you get to really fast tempos, most people have no idea how many actual notes they pick. They will swear that they do, but they really do not. They often under or over pick.

    So your game may already be keeping up just fine, but it is you who thinks is faster than you actually are

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