1. Precalculate the 1000/framerate and use a local variable instead. Saves quite some calculation time :-)
2. There is the way of FPS Modifier which means that you modify all movement,speed etc values with a factor that depends on your actual fps (normally 1.0/fps)
If you do so, you can modify your above code that only flip depends on the time passed since so you can replace the while wend with a if then endif. This way your calculation power runs at its max while the fps is still on the wished point.
I sometimes even used it to fill the rest of the frame with a delay which is needed in B3D to prevent "full cpu usage"
2. There is the way of FPS Modifier which means that you modify all movement,speed etc values with a factor that depends on your actual fps (normally 1.0/fps)
If you do so, you can modify your above code that only flip depends on the time passed since so you can replace the while wend with a if then endif. This way your calculation power runs at its max while the fps is still on the wished point.
I sometimes even used it to fill the rest of the frame with a delay which is needed in B3D to prevent "full cpu usage"