My code from working through the book HTML5 Game Development for Dummies.