Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/12/2024 in all areas

  1. Set your old timestamp variable to null when the game is started/restarted. this.oldTimeStamp = null; Then in your game loop function, check if it's null and if so store the provided timestamp. if (this.oldTimeStamp===null){ this.oldTimeStamp=timeStamp; } This way your game always starts out at 0 for seconds passed. Currently, your first iteration when the page loads is essentially random as it depends on how long it takes for the browser to run the first game loop after starting the page.
    1 point
This leaderboard is set to New York/GMT-05:00
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.