Coding Club

Game making in JavaScript

Six games, written in JavaScript, the language every web browser understands. They are built in the site's Web Studio, so they work on any school computer, a Chromebook or a computer at home, with nothing to install and no account. Each step's game runs on its page, so you can play it as you build it, and Download saves your finished game as one file that plays anywhere.

Six days, six projects

One small project a session. Each one is a numbered list of steps with a picture of what to click and what you should see, then tests and stretch challenges for anyone who finishes early.

Day 1Balloon PopPop the balloons before they float away: your first game, drawn and animated on a canvas.
Day 2Meteor DodgeSteer a spaceship with the arrow keys and dodge a storm of meteors that gets faster the longer you last.
Day 3Paddle RallyKeep a bouncing ball in play with a paddle. Hit it near the ends to send it flying off at an angle.
Day 4Pair UpA memory game: turn over two cards at a time and find all eight matching pairs in as few moves as you can.
Day 5Treasure MazeBuild a maze from a few lines of text, then collect every coin to unlock the exit. Then design your own.
Day 6Gem JumperMake a platform game: run, jump between ledges, mind the water, and collect all five gems against the clock.

Get set up before day 1

You will need

  • Any computer with a web browser, including a Chromebook
  • A mouse and a keyboard
  • The Web Studio on this site, or Notepad
  • Nothing to install and no account
  1. Setup step 1: Open the Web Studio

    Every game is made in the Web Studio, which is part of this site: nothing to install and no account. Open it in a new tab, then choose the day's game under Games in the Project list. Each game starts you off with its first step already typed in.

    Choose the day's game from the Project list.
  2. Setup step 2: Where the code goes

    A game is a web page. index.html holds the canvas, the box the game is drawn in. style.css sets the colours round it. script.js is the game itself, in JavaScript, and it is where you will spend most of your time. Each step says which tab its code goes in.

    Most of each game is in the script.js tab.
  3. Setup step 3: Click the game to play it

    The preview runs your game as you type. A game only hears the keyboard once you have clicked it, so click the preview, then press the keys. Every step on these pages also has the game running in it: click it and play.

    Tip If a game stops working, an error has usually crept in. Look back at the step's highlighted lines, and check every bracket and quote.
  4. Setup step 4: Keep your game

    Download saves your game as one .html file. Double click it on any computer and it plays in the browser, even without the internet, so you can take it home on a memory stick or email it to a friend. Copy a link makes a link with the whole game inside it.

    Download saves the whole game as one file.
Notes for the teacher

Before the first session

  1. Open the Web Studio on a club computer and play one of the finished games, to check the school's filter allows the site. Everything runs in the browser, so nothing needs installing, and it works on Chromebooks too.
  2. Work is saved in each browser, on that computer. If students change computers between sessions, they should use Download or Copy a link at the end of each session. Every day also starts from its own starter, so nobody is ever stuck.
  3. Keyboard games need a keyboard, and the game must be clicked before it hears the keys. Remind students of this every session!
  4. The Web track's first days (HTML and CSS) help but are not needed: each game explains what it uses.

Why JavaScript?

JavaScript runs in every web browser, so these games need no Python, no installer and no permission from IT. A downloaded game is one .html file that runs offline on any computer, which students love to take home and share.

How the six games build up

Day 1 is drawing, the game loop and the mouse. Day 2 adds the keyboard and collisions, day 3 velocity and bouncing, day 4 state and a page built from code, day 5 grids and level design, and day 6 gravity and platforms.