I am making a game for PC that's a clone of the Project Diva games. To put a long story short for those who don't know the game, it's a rhythm game where notes fly from off screen to a receptor placed on screen. I have the notes defined as having a starting position off screen, and a receptor position. To keep in sync, I sync the position to the current position in the song, in beats.
Right now, I determine it will take any note 4 beats to reach the receptor from beginning. I keep track of the beat when the note spawned and the current beat. This basically gives me a lifetime of the note. I normalize it to 0-1.0, but it can go beyond 1.0, if it's lifetime is greater than 4 beats. This allows the player to hit the note a bit late, which is something I definitely want to keep. I plug this normalized lifetime into a simple linear interpolation, and boom. Movement synced to the music.
In code
float progress = (_current_beat - _start_beat) / NOTE_TRAVEL_TIME;
_nx = _start_nx + (_pos.x - _start_nx) * progress;
_ny = _start_ny + (_pos.y - _start_ny) * progress;
It works nice but it's missing something. In Project Diva, the notes don't travel in a straight line, but take a curved path. I guess the best way to show it is with a video:
I've been working through the last few days trying to mimic this behavior. I'd figure the way is to somehow find a parameterized equation that follows a curved path that finds it's way at the receptor at t=1.0. This is way easier said than done, because the speed has to remain constant.
The closest I was able to get is $\left(a\cos(\omega t) + b, a\sin(\omega t) + c)$, which is basically riding the circumference of a circle of radius a, and differentiating the arc length of this function with time gives us a constant $a\omega$, so constant speed. I could somehow calculate the constants that would fit the two points, and adjust and hope it looks good. I am going to try it out, but this feels way too nasty though, and I feel like I'm overdoing it. I'm coming here to see if anyone might have a better solution to this.