I’m making a rhythm game and i have a sprite that i need to rotate in sync with the song’s bpm. Every beat should be a 90 degree rotation. I made this bit of code and i just plug in the bpm of whatever song im using. The song im testing with right now is 181 bpm.
Sprite.rotation += (deg_to_rad(90) * (delta * (bpm/60)))
It’s close to accurate but its slightly too slow and only syncs up midway through the song then isn’t synced anymore after a few seconds. i don’t know how to make it any more accurate than it already is.
I also noticed that the rotation is never at 0, 90, 180, 270, or 360 degrees, because when i set it to print something every 90 degrees i get no output.