Get your API key

Lesson 3 of 6

Build the 2D game in five safe steps

Draw the screen, move the basket, catch the mango, count the points, end the game. One testable change per prompt.

9 min Log in to open
One step at a time, like flipping pages.

By the end of this lesson you will have a playable 2D game, built in five prompts, where each prompt makes one change you can check before you ask for the next one.

You need: the brief from the last lesson, and a folder on your computer · Time: 9 minutes

  1. A canvas is the drawing area that a web page gives you. You put one line in the page, and from then on the code can draw rectangles, circles, text and images inside that area. Everything in a 2D browser game is drawn on a canvas, or on something built on top of one.

    You have four common choices for what draws your game:

    What you use What it gives you When it is the right choice
    The plain canvas Drawing, and nothing else. You write the loop and the rules yourself, with the agent A first game with one screen and one mechanic
    Phaser A complete 2D game framework with scenes, sprites and physics built in When the game grows past one screen
    KAPLAY A friendlier game library with fewer ideas to learn A middle ground between the two
    PixiJS A fast drawing engine, but not a game framework When you already know what you are building

    Phaser's current major version is 4, with 4.2.1 as the latest release, and KAPLAY's current stable line is 3001. Those numbers were checked on 20 November 2026, and they will change, so ask your agent for the current version instead of copying a number from any tutorial.

    Why?

    Starting on the plain canvas is not the beginner option. It is the option that keeps the whole game in two files you can read, and it teaches the loop properly. Libraries hide the loop, and hiding it is the last thing you need on day one.

Log in free to read the rest of this lesson

Every lesson is free. A free account unlocks all of them and saves your progress.

Still to come in this lesson:

  1. Five steps, five checks
  2. Step one: draw the empty screen
  3. The same prompt shape, five times
  4. When the screen stays empty
  5. Recap