Build a Maze Game with Vanilla JavaScript, Part 2

Nevin Katz
CodeX
Published in
15 min readApr 14, 2021

--

Welcome to Part 2 of this tutorial series on building a maze game with JavaScript, HTML, and CSS!

If you have not tried Part 1 yet, you can either try that first or download the tutorial code from Github and work off of the tutorial directory starting with mg1-one-level-keyboard, which contains the finished version from Part 1.

If you have completed Part 1, you will know that we built a one-level implementation that used keyboard controls but no on-screen buttons.

In this tutorial, we will finish this maze game, adding touch screen controls and two additional levels. This full implementation is shown in the Pen below.

Building out this full game shown above will entail the following:

  • adding on-screen controls
  • creating two additional levels
  • making the marble wobble when it collides with a wall or boundary
  • enclosing our code in an immediately invoked function expression (IIFE)

--

--

Nevin Katz
CodeX

Developer at EDC. I write about web development and biology. Subscribe at https://buttondown.email/nevkatz for article roundups.