Coding ยท ยท

Retro game project

You will be working in teams of 2 on a <canvas> web-based retro game over 2 lessons, presenting your games at the end of the 2nd lesson. Here are the games to chose from, in rough order of difficulty from easier to harder:

Presenting your work

You will have ~5mins to present your game in the last 30mins of the 2nd lesson. You need to demonstrate your game, and talk through the code, debugging, troubleshooting, decisions etc.

Requirements

All games must be in a single HTML file in which the game is in a fixed-size <canvas>. Here's a simple template to get you started:

<!doctype html>
<title>Retro game</title>
<canvas id="canvas" width="600" height="400" style="background: #eee; margin: 50px auto; display: block;"></canvas>
<script>
let ctx = canvas.getContext('2d')
ctx.fillRect(10, 20, 30, 40)
</script>

Games must be online (on either of your websites or elsewhere) before the presentations.

Tips for success

Persisting data (eg high scores)

Some games can do with storing/persisting data (eg high scores) between refreshes, similar to when we used a .json file on the CLI. You can use localStorage to do this as follows:

// get the stored high score
let highScore = localStorage.getItem('highScore') || 0

// whenever you need to store a new high score
localStorage.setItem('highScore', score)

Game details

Your game needs to hit as many of the listed items as possible. These are generally in priority order. Try not to add additional features until all/most from the list are met.

Memory pairs

Whack a mole


Pong


Snake


Typing of the dead


Flappy bird


Space invaders


Breakout


Asteroids

For this one, I strongly recommend starting with a stationary spaceship, and only adding forward movement if other criteria are met.