javascript - Why speed of my game character is different in different computers? -


i developing online game using java script. using setinterval (movimage, 10) method move game character. have seen movement speed of game character not same computer. please suggest me.

instead of setinterval should use requestanimationframe (https://developer.mozilla.org/en-us/docs/dom/window.requestanimationframe).

there no point trying update quicker screen can draw. aiming 60fps, 16ms per frame.

http://paulirish.com/2011/requestanimationframe-for-smart-animating/ has more info how this.

browser support pretty (http://caniuse.com/#feat=requestanimationframe) in short, current browsers apart android stock browser.

if must have working in ie9 , lower, https://gist.github.com/paulirish/1579671 decent job of simulating behaviour in browsers. (though honest, suspect last of worries, particularly in regard lack of canvas…)


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -