Hi guys. It's been a while and this place has changed a bit. Well, I'm working on a clicker-style game and I need an accurate way to calculate clicks per second (cps). I've sort of hard-coded a simple way of doing it, but I find it isn't as accurate.
taps=0;// number of taps/clicks player makes
frames=0;// initial time keeping variable
sec=0;// conversion from frames to seconds
taps_per_sec=0;// how many taps/clicks per second
frames += 1;
//...convert time (frames) to sec (seconds)
sec = frames / room_speed;
taps_per_sec = ceil(taps / sec);
// Each time the player clicks the alarm is reset to room_speed and taps is
// increased by 1
This works a okay, but I'm in need of a more accurate method. This is where algebra comes in and I stink at creating algebraic equations. Maybe if there is a time stamp of each click and then calculating the time in between clicks, like the pneumatic road tubes calculating car speed. I don't know. I'm kind of stuck here though so any help would be appreciated.