With Membership
Suggested price


Learn Modern Javascript, HTML5 Canvas, and a bit of EmberJS

About the Book

This is a book about surviving an alien invasion and using web technologies.

In this book you'll learn the basics of Javascript (including some new ES6+/ES2015+ features), play with HTML5 Canvas, and take advantage of EmberJS and ember-cli.  You'll also train as a PAC operator- ripped from your comfy lab by a special order from the Elders, you must learn quickly in order to help fight off the alien menace.

BUILD PACMAN is meant for users who know at least one other programming language but aren't terribly experienced with Javascript.  However, it's also useful for people who know Javascript but want a gentle introduction to (parts of) EmberJS, people who are curious about new Javascript features or HTML5 Canvas, and people who just want to relax and BUILD PACMAN.

About the Author

Jeffrey Biles
Jeffrey Biles

Jeffrey loves EmberJS, teaching, writing, and making games.  If only there were a way he could satisfy every single one of those in one project...

Anyways, you can catch more of his work at, where he's created over 100 videos about EmberJS and Javascript.

You can also contact him at to find out about getting Ember training for your company.  Yes, you should do that.

Table of Contents

  • In Media Res
  • 1: Drawing A circle
    • Installation
    • Creating your app
    • Displaying a box
    • Drawing a circle
    • Setup complete
  • Training
  • 2: Getting up to speed
    • Components
    • Handlebars
    • Canvas
    • Css
    • Canvas context and drawing
    • Let
    • didInsertElement
    • Functions
    • import/export
    • Feeling good yet?
  • Control
  • 3: Input
    • Steal This Code
    • Bringing it in
    • Mixins
    • Defining keyboard shortcuts
    • Hashes
    • Logging
    • Summary
  • Displacement
  • 4: Movement
    • Properties
    • Updating Properties
    • Moving the PAC
    • Clearing the screen
    • Extracting methods
    • A computed property
    • Summary
  • Barriers
  • 5: Enclosure
    • Alignment
    • If statements
    • Fully functional collisions
    • Handlebars Binding
    • Summary
  • The Maze Inside
  • 6: Internal Barriers
    • Drawing a wall
    • Walls, arrayed before us
    • Drawing all the walls
    • Call the Draw
    • Wall Collisions
    • Summary
  • Clearing a Path
  • 7: The Grid
    • Seeing the grid
    • Arrays of arrays
    • Displaying the grid
    • Calculating the level width and height
    • Deep gets
    • Moving through the space
    • Summary
  • First Harvest
  • 8: Pellets
    • Drawing Pellets
    • Say what you do, do what you say
    • Scope Troubles
    • Fat Arrows
    • Share your circle
    • Processing the pellets
    • Summary
  • Gains and Losses
  • 9: Scores and Levels
    • Keeping Score
    • Level Up
    • New Syntax
    • Summary
  • Smooth, Efficient
  • 10: Animations
    • Coordinating Directions
    • nextCoordinate and Interpolated Strings
    • Looking ahead with the Grid
    • Smooth Animations
    • Guarding our movement
    • The Movement Loop
    • Drawing with FrameCycles
    • Summary
  • No Stopping
  • 11: The Game Loop
    • Rollin rollin rollin
    • The Intent system
    • Summary
  • Objectifying
  • 12: Separation of Concerns
    • Defining new files
    • Return of the ES2015 Modules
    • Classy Systems
    • Mixins
    • Classes and Instances
    • Summary
  • Loyalties
  • 13: Separation of Concerns
    • Separation: Pac Object
    • Separation: SharedStuff Mixin
    • Separation: pac-man Component
    • Separation: Partial method extraction
    • Resyncing on Restart
    • Summary
  • Separation
  • 14: Level Out
    • The Level Object
    • Restarting It All
    • Making it all fit
    • LessSharedStuff
    • Another Level
    • The Level Gains More Regulatory Power
    • Summary
  • First Haunting
  • 15: Ghostly
    • The Ghost Itself
    • True Colors
    • Movement: It’s alive!
    • Heat-seeking Ghosts
    • Map
    • Where’s the Pac?
    • The (Weighted Random) Chase
    • Summary
  • Sacrifice
  • 16: Contact
    • Multiple Ghosts
    • Better Arrow Functions
    • Collision Detection
    • Places, Please
    • Super Spread(optional)
    • Level Knows Best
    • Extra Lives
    • Summary
  • Ruins
  • 17: Moving On Down
    • The Level Array
    • Changing Levels
    • Summary
  • Patrol
  • 18: Teleport
    • Finding What to Change
    • Where Do We Go From Here
    • Turning It On
    • A Teleport-First Level
    • Summary
  • A New Hope
  • 19: Power
    • On The Map
    • Changing Colors, Ternary Operators
    • Resetting the Level
    • Summary
  • The PACs Strike Back
  • 20: Turning the Tide
    • Ghost Run
    • Shorthand Operators
    • More Specific Collisions
    • Full Retreat
    • Regroup
    • Summary
  • The Return of the Jihadi
  • 21: Time’s Up
    • Timers
    • Power Waning
    • A New If
    • Changing Colors
    • RGB
    • Mixing Colors
    • Retreat, Redone
    • Summary
  • Epilogue
  • What’s Next?
  • Notes

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub