🪲 Debugging
-
Make sure Live Server is running.
-
In Visual Studio Code, hit F5 or Run -> Start Debugging.
-
It will ask which configuration to use, select Chrome.
-
In the
launch.json
it creates, make sure the port number is the same port number that Live Server is using, usually 5500. -
Hit F5 or Run -> Start Debugging again, and a window should open up with the game running. You can now add breakpoints to the code.
-
Hard code the value of
deltaTime
.Game.js gameLoop(currentTime = 0) {// Calculates delta time and converts it to seconds instead of milliseconds.const deltaTime = (currentTime - this.lastTime) / 1000;const deltaTime = 0.016;this.update(deltaTime);this.lastTime = currentTime;requestAnimationFrame((time) => this.gameLoop(time));}