This is Chapter 2 from the book HTML5 Games: Novice to Ninja

Chapter 2