ucm

Members
  • Content count

    1
  • Joined

  • Last visited

Community Reputation

124 Neutral

About ucm

  • Rank
    Newbie
  1. [web] JavaScript game loop

    [quote name='BUnzaga' timestamp='1322809570' post='4889702'] Here is my updated game loop for html5 canvas. It works well for both 'fast' and 'slow' computers... [code] // setInterval(GameLoop, 1); var old_time = Date.now(); var FPS = 1/60; function GameLoop(){ var new_time = Date.now(); var dt = ((new_time - old_time)/1000); while(dt > FPS){ Update(FPS); dt -= FPS; } Update(dt); Render(); old_time = new_time; }[/code] Let me know if you find any 'issues' with this I have been working on it for a couple days now, and like the results. [/quote] Awesome BUnzaga! Now lets see more man ;-)