I want to make a Rhythm game. I found in the forum a nice way to have the beat of the music, which is the basis of everything that follows.
Basically what I do is that I have a variable "bpm" which corresponds to the bpm of my music, and I start a timer for 1/(bpm/60), bpm/60 = beat per second, and 1/bps = seconds per beat. It works pretty great.
Then what I do is I add 1 to a variable "nbBeat" every time we are on timer (= every beat). With this I can keep track of the beats and their number. With this I can start special events at some point of the music, animate sprites accordingly, etc.
I can also do some modulo to get the even numbers and do something with it. Anyway, you get the idea.
Now what I want to do, is to check if a player tap the button at the corresponding beat (for now, every beat). And by extending this, I want to check if the player missed a bit or is pressing the button off beat.
But I saw that you can't check for a button pressed and a OnTimer in the same event. What I did is that when we are OnTimer, I change a sprite to an animation. And then in another event I have "when this animation is playing AND player is pressing <key>", which set a boolean to true for the time of a beat. It's a bit crappy but it kinda works, not perfectly tho. Also, this solution doesn't work with the situation where the player miss a beat.
So, here is my question:How can I check if the player is pressing a button on timer? How can I check if he missed a beat, or if he is off beat?
Thanks a lot for your help.
You can see the basic rhythm stuff with the timer here: https://www.youtube.com/watch?v=IvFxuIhE9V8
And here are some crappy events of what I just explained;