Pixel Courier tileset6 tiles · 16 × 16 each
Lesson 03 · 65 minutes · World layer
Build a world from 16-pixel bricks.
A tileset is a small set of square pieces. A tilemap is a grid that says which piece goes where. With six tiles and a text grid you can build every level in Pixel Courier.
Where this comes from
Tiles let a tiny memory hold a huge world.
Pac-Man’s maze is built on a grid of tiles, and console games of the 1980s stored levels as lists of tile numbers instead of full pictures. A screen of 8 × 8 tiles needs one byte per tile — far less than one byte per pixel.
The Maze tutorial already uses this idea: its walls are a grid. Here you draw the tiles yourself and see the grid as text.
Tileset lab
Paint tiles that tile.
- Pick a tile.G grass, D dirt, B brick, C crate, = one-way plank, ^ spikes.
- Paint, then run the seam test.Use dirt for an all-direction seam test: look for unwanted lines in the 4 × 3 preview. Grass has an intentional top edge; test it in a horizontal row.
- Keep the rules.Changing the picture never changes whether a tile is solid — that lives in the tile’s data.
Tilemap lab
A level is just text.
Paint with the brushes. Watch the text version change: every character is a tile ID. 🌱 Ground (auto) is a rule tile: it places grass when nothing is above and dirt underneath. Turn on Collision layer to see what the physics will treat as solid.
Level editorShared with lessons 05–10
const level = [
"..S......P...M.",
"GGGGGGGGGGGGGGG",
"DDDDDDDDDDDDDDD",
];
const tile = (col, row) => level[row][col]; // look up any cell
const isSolid = id => tiles[id] && tiles[id].solid; // rules live in dataTheory: autotiling
Let neighbours choose the edge.
Hand-placing “top-left corner”, “top edge”, “right wall”… is slow. Autotiling looks at the four neighbours and adds up a bitmask: up = 1, right = 2, down = 4, left = 8. The total (0–15) picks one of 16 tile variants. Click cells below.
4-bit autotileClick to add or remove ground
function mask(x, y) {
return (filled(x, y - 1) ? 1 : 0) // up
+ (filled(x + 1, y) ? 2 : 0) // right
+ (filled(x, y + 1) ? 4 : 0) // down
+ (filled(x - 1, y) ? 8 : 0); // left
}
const variant = groundTiles[mask(x, y)]; // 16 hand-drawn variantsDefinition of done
Your world kit is ready when…
0/4 checked
Evidence: Explain to a partner how the text grid becomes both the picture and the walls.
Lesson 03 complete?
Your art and settings are already saved for the next lesson.