davethomas11 / V_Is_For_Vince

1 stars 0 forks source link

Get the game running with the browser's framerate #5

Closed Tsmith18256 closed 7 years ago

Tsmith18256 commented 7 years ago

We can lock the game to the browser's framerate by calling start from requestAnimationFrame (and making it recursive. The delta time can be calculated by adding a time service that stores the current time and the delta time. In the next frame, the new delta can be calculated using the currently-stored time.