Skip to content

Commit

Permalink
Switch to own curTime
Browse files Browse the repository at this point in the history
  • Loading branch information
cykod committed Apr 13, 2013
1 parent 47cdbe3 commit 5e2c372
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 2 additions & 1 deletion engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ var Game = new function() {
var lastTime = new Date().getTime();
var maxTime = 1/30;
// Game Loop
this.loop = function(curTime) {
this.loop = function() {
var curTime = new Date().getTime();
requestAnimationFrame(Game.loop);
var dt = (curTime - lastTime)/1000;
if(dt > maxTime) { dt = maxTime; }
Expand Down
4 changes: 1 addition & 3 deletions game.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,7 @@ Explosion.prototype.step = function(dt) {
};

window.addEventListener("load", function() {
setTimeout(function() {
Game.initialize("game",sprites,startGame);
},50);
Game.initialize("game",sprites,startGame);
});


0 comments on commit 5e2c372

Please sign in to comment.