@aleks said:
Hey man! Your game looks great, the idea is unique and fun.
How did you deal with the impossibility to set a precise tempo in Godot?
I am doing a kind of simpler notation app for myself, and I just cannot solve the problem of timing being kept through delta which wobbles around and makes everything awful.
How did you manage?
Remember, we have to calculate the spb (seconds per beat) which is:
spb = 60.0/BPM
Then I initialized a variable called:
timer = 0
In the process/update I incremented timer by delta
func physics_process(dt):
timer += dt
if (timer >= spb):
timer -= spb
#and do something that reacts to the beat
which means the timer range would be 0 to spb.
If you want the range to be 0 to 1 then you do this:
timer0to1 = timer * spb
If you want it to be precise as possible, then I'd personally do something like this:
func physics_process(dt):
timer += dt
var is_between = TIME < spb && TIME+dt> spb
var is_over = TIME >= spb
var negative_check = spb-TIME < (TIME+dt)-spb
if (is_between && negative_check) || is_over:
timer -= spb
#and do something that reacts to the beat