rate of button presses - how would you do this?

SquareHeartSquareHeart Member, PRO Posts: 69
edited February 2012 in Working with GS (Mac)
I've been working on a quick-and-dirty button masher for the hell of it. Now, thinking this was easy (foolish!) I've discovered a rich vein of non-knowledge that I'm currently mining. I've got my pickaxe stuck in one particular problem and just can't seem to get it working.
I'm trying to effectively create a speedometer that will show the rate of button presses (the game is just a button spamming how-many-presses-in-30secs-type-affair).
I've tried the ol' rate = distance/time (with distance being button presses) but it just doesn't seem to calculate right. (seems to end up as an average of the button presses over total time :/ )
I've tried doing a modulus of actual button presses against a timer that captures button presses every .x secs (that probably doesn't make sense) but it kinda works but it reverts back every .x cycle and fails miserably.
the goal to be able to calculate the rate of the button was to be able to control the opacity of an "on fire" effect and trigger comments amongst a pile of other stuff - this also requires the ability to be able to figure out how long the rate holds at (i.e if player maintains a rate of 10button presses per sec for 3 secs - show actor "great guns!"), this is the next challenge :o

any thoughts are greatly appreciated!

Comments

  • POMPOM Member Posts: 2,599
    edited February 2012
    My thoughts about it :
    1) i just made it for you ;) you can download the file here :
    http://www.mediafire.com/?995zq04dv6fedyu

    2) please don't make a "tap as much as you can" game out of it and upload to the appstore ;) use it for learning purposes and maybe to your device only (to show friends etc)..

    Roy.
  • SquareHeartSquareHeart Member, PRO Posts: 69
    oh thanks! you are a champ!
    Just have to update my game salad........*insert rainbow beach ball here*.....
    Okay yup, that looks nice and simple, sample number of taps per x sec. Looks like I was trying to be too clever with my mathZ :)
    thanks again, your help is much appreciated.




Sign In or Register to comment.