HTML5 Foundations
Document structure, elements, attributes, images, links, semantic tags and a first taste of CSS.
Learn HTML5 game development by reading, running, and rewriting real games. Every lab gives you the objectives, a guided file-by-file activity, a live preview of each game, and checkpoints you tick off as you go.
This lab teaches HTML5 and JavaScript by building complete, playable games — the same teaching approach used in The Essential Guide to HTML5: Using Games to Learn HTML5 and JavaScript (3rd edition) by Jeanine Meyer. Rather than learning the language in isolation, you start with a small working game and grow it step by step, one idea at a time.
Each of the six weekly labs is adapted from one of the book's games and follows the same objectives → guided build → complete-the-code flow:
Everything is written in plain HTML5, the Canvas 2D API and JavaScript — no frameworks and no libraries — so what you write is standard web technology you can reuse anywhere.
The games you build include the Craps dice game, the bouncing ball, the cannonball and slingshot, the memory (matching) game, and an ordering quiz with audio and video rewards. Examples and game ideas are adapted from The Essential Guide to HTML5 (3rd ed.) by Jeanine Meyer.
Document structure, elements, attributes, images, links, semantic tags and a first taste of CSS.
Draw with <canvas>, generate random numbers, handle clicks and build the Craps dice game.
Animate with timers, bounce a ball off walls, wire up form inputs and mix in images, gradients and video.
Build reusable game objects, follow mouse input and launch a projectile with gravity in the slingshot game.
Arrays, images, shuffling, click hit-testing and match logic — plus drawing polygons on the canvas.
Control media from JavaScript and build an ordering quiz that rewards correct answers with sound and video.
From Week 7 the games move into 3D. Each week uses Three.js (r170), the most widely used 3D library for the web, and ends with a complete, playable 3D game. The JavaScript skills from Weeks 1–6 (events, game loops, collision and scoring) carry straight over.
Each 3D week is a small Node.js project: npm install three installs Three.js and
npx vite runs it (Week 7 shows how to install Node.js). See the
Setup guide.
Scene, camera, renderer, meshes and the animation loop — build Cube Stack, a stacking game.
Materials, spot and point lights, shadows and orbit controls — search a dark room in Torch Hunt.
Keyboard state, steering with sin and cos, groups and a chase camera — drive and park in Park It!
Bounding boxes, walls, pick-ups and hazards — grab every coin and dodge the spikes in Coin Collector.
Click on 3D objects with a Raycaster, hover effects and timed spawns — play Whack-a-Mole 3D.
Velocity, gravity, aiming and impacts — Week 4’s cannonball returns in 3D in Cannon Tower.
Canvas textures, Web Audio sound effects and an on-screen HUD — a polished shooting gallery, Target Range.
Game states, spawning, object pooling, fog and difficulty — put it all together in Lane Runner.
Week1) on your PC and copy the example
files you need from this site into it.filename_yourname.html in the same week folder.No server needed: just open index.html in your browser. Progress and quiz scores
are saved in this browser only. Lecturers can add ?answers=1 to a lab URL to reveal all hints
and solutions.
New to the tools? Read the Setup guide for VS Code and Sublime Text instructions.