Last week I talked about how I was going to be rewriting arrow scrolling yet again, and I’m glad to say it’s been done. Here is a video showcasing the new scrolling (with a stop!)
For those interested, here’s how it works now:
When the simfile is loaded up, I grab all of the BPMs and Stops, take the beat offsets at which they occur (the simfile gives me this information directly) and convert them to corresponding time offsets using a few loops and some math. Now I go and generate all of the arrows and pass along their beat offset to them.
Next, during each “tick” of the game, I calculate the current value of the timer since the song started (in milliseconds). Then I take that timer value and do some more loops and math with the BPM and Stop offsets I stored earlier to convert the timer value to a corresponding beat offset. Each arrow then grabs that beat offset, compares it to its own, and positions itself a corresponding distance away from its arrow receptor.
All in all, it wasn’t that tricky to write, and I was actually able to end up reusing a significant portion of the beat→time function with some relatively minor modifications. Now truthfully, it’s not 100% perfect yet, as testing with a song with many BPM changes and Stops produced some…interesting results. I expect to be able to iron out any quirks with a little bit of tinkering with my functions though.
Until next time, then!