Skip to content

Commit

Permalink
requestAnimationFrame upgrade; improve README; imageOptim
Browse files Browse the repository at this point in the history
  • Loading branch information
richtaur committed Apr 22, 2014
1 parent 256d456 commit f24d734
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
6 changes: 5 additions & 1 deletion README.md
@@ -1,3 +1,7 @@
# How to make a simple HTML5 Canvas game

Build your first HTML5 Canvas game in no time! [Read the whole article here!](http://www.lostdecadegames.com/how-to-make-a-simple-html5-canvas-game/)
Build your first HTML5 Canvas game in no time! [Read the whole article here.](http://www.lostdecadegames.com/how-to-make-a-simple-html5-canvas-game/)

* Subscribe to the [Lost Decade Games blog](http://www.lostdecadegames.com/rss.xml)
* Listen to [Lostcast](http://www.lostdecadegames.com/lostcast/), the indie game dev podcast
* Follow us [@LostDecadeGames](https://twitter.com/LostDecadeGames)
Binary file modified images/background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/hero.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/monster.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 9 additions & 2 deletions js/game.js
Expand Up @@ -115,9 +115,16 @@ var main = function () {
render();

then = now;

// Request to do this again ASAP
requestAnimationFrame(main);
};

// Cross-browser support for requestAnimationFrame
var w = window;
requestAnimationFrame = w.requestAnimationFrame || w.webkitRequestAnimationFrame || w.msRequestAnimationFrame || w.mozRequestAnimationFrame;

// Let's play this game!
reset();
var then = Date.now();
setInterval(main, 1); // Execute as fast as possible
reset();
main();

0 comments on commit f24d734

Please sign in to comment.