Tutorial · nothing to install

Your first game, chapter by chapter

You're going to build a complete brick-breaker: paddle, ball, wall, score, and that grainy nineties-console look. All of it happens on this page — nothing to install, and no need to have written code before.

This is what you'll have at the end. Move with ← →
Start with chapter 1

The chapters

  1. 01The screenBoot the engine and stare at a coloured rectangle. Less boring than it sounds.
  2. 02The paddleYour first object on screen, and why the coordinates run the opposite way to the ones you learned at school.
  3. 03Make it moveThe game loop, and the one number that separates a game that works from one that runs twice as fast on your friend's laptop.
  4. 04Take controlKeyboard input, and the one-line detail that stops the paddle escaping off the edge.
  5. 05The ballVelocity on two axes, bouncing, and why the angle you leave at depends on where you hit it.
  6. 06The wallForty bricks from a loop inside a loop, and the moment the game stops fitting in one file.
  7. 07Break themRemoving an object from the game, and why the engine waits until the end of the frame to do it.
  8. 08Score and livesText on screen with a bitmap font, and the two lines that turn this into a match you can win or lose.
  9. 09Make it 1997One line of code that runs a filter over the whole screen and turns your rectangles into a 16-bit console.