Author: Karl Bunyan
Publisher: No Starch Press
Date: March 30, 2015
Reviewer: Mike James
If you want to build an HTML5 game is this the book you are looking for?
The main thing to say about this book is that it isn't for the beginner in programming or in using HTML and CSS. It also takes for granted that you know what the DOM is and roughly how to work with it. It also make heavy use of jQuery and Modernizer.
Chapter 1 explains the details of the game that is the subject of the entire book. It is a simple animated bubble game. You shoot bubbles off and they collide and when you get a big enough group they pop. It is a simple game, but it is a fairly complete one that you might even consider putting in an app store and hoping that it goes viral. The point is that this isn't a cut down demo - it is the real thing.
Chapter 2 is a fairly standard account of sprite-based animation using the DOM. We have a lot of working out of angles and directions and here you might wish you had paid more attention to trigonometry.
Chapter 3 is about making things look better, drawing the board and managing the sprites. The second half of the chapter is about collision detection which is always something that seems as though it should be simple, but in practice always turns out to be more difficult and subtle than you imagined.
Part II of the book works over the game a second time, but now using Canvas rather than the DOM approach. There are programmers who might think that this is the only sensible approach and the DOM is for pre-HTML5 games. However, DOM/CSS animation is still worth knowing about.
Chapter 5 introduces CSS transitions and transformations. Then on to Sprites implemented directly in Canvas in Chapter 6. As this is just a case of drawing bitmaps to the Canvas object it seems simple and straightforward. Chapter 7 introduces simple ways of creating game sounds, implementing high score displays and how to keep track of the user.
The final chapter is a overview of things that have been left out of the book. Topics include Ajax, websockets, webworkers and WebGL, each treated in a short paragraph. Next we have a section on deployment which is probably the topic the book misses out on the most. Writing a web app means you can deploy it as a Chrome or Firefox app or even as a native app using PhoneGap. In this chapter you get to learn about handling touch events and scaling and there's a quick look at PhoneGap. The final few pages are on optimization and security.