So, you want to build an idle/incremental game in JavaScript and you’ve read on the internet that setInterval
is the way to go when it comes to handling resources that automatically generate over time.
You get started, you write down your setInterval
function, you set it to trigger once every 1000 milliseconds, and every time it triggers, you add 1 to the player’s total resource count. Perfect. It works.