Ellim / S-TSiR

Survive: The Struggle is Real
GNU General Public License v2.0
3 stars 0 forks source link

Consider using window.requestAnimationFrame instead of window.setInterval #4

Open PiMastah opened 8 years ago

PiMastah commented 8 years ago

Most notably, when running S-TSiR in a background time, time passed does not equal time elapsed in game since setInterval only works as assumed in active tabs due to resource consideration.

However, requestAnimationFrame allows to evaluate the parameter passed to the callback in order to deduce time elapsed.

Take a look at the documentation and see if you would like to go down that route.

Documentation

Browser support

Code part

Ellim commented 8 years ago

Thank you! I knew I needed to add something like this but wasn't quite sure where to begin.

PiMastah commented 8 years ago

If you need help with integrating this, I would be happy to help you out. I quite like your game so far and think it has great potential :)