HTML and CSS Reference
In-Depth Information
Game . canvas . removeEventListener ( 'click' , Game . restartGame , false );
Game . init ();
}
};
And that's it! With that last snippet, your Canvas Ricochet application is complete. Try it
out, and then share it to amaze your family and friends.
6.4.3. Getting help from code libraries
By completing Canvas Ricochet, you're now capable of coding games from scratch in Can-
vas. It did take a while to code everything. To help save time and money on projects, you
might want to use a JavaScript library. For example, Impact.js would let you write Can-
vas Ricochet in 100 lines or less (but then you wouldn't have learned how to use Canvas,
either). You also need to consider that engines aren't optimized for your code and will of-
ten decrease a game's speed performance. Currently most developers prefer ImpactJS, but
there are other options you can find out more about at http://html5gameengine.com/ .
ImpactJS
ImpactJS, or the Impact JavaScript Engine, is one of the fastest and most-effective HTML5
libraries. It has documentation that's rapidly growing and video tutorials to get you moving.
The only catch is that it costs $99 per license, which is kind of steep if you just want to test
it. Figure 6.11 shows a complex game created with this library.
Search WWH ::




Custom Search