thomas-alrek / JSGame

JavaScript + Canvas 2D game engine
GNU General Public License v2.0
56 stars 6 forks source link

fixedUpdate should run inside requestAnimationFrame #17

Closed thomas-alrek closed 8 years ago

thomas-alrek commented 8 years ago

fixedUpdate now runs in a setTimeout loop. For performance and timing, it should be moved to be ran at the end or beginning of each frame. We could do a simple test on Time.fps % desired_frame_rate == 0, or just simply run it on the same frame rate as update().

thomas-alrek commented 8 years ago

Fixed in https://github.com/alrek-consulting/JSGame/commit/143c63e294ccdf3ecb32b724ba3c7a221fe73047