Game Design & Development · Tiny-Loop Tutorial · Archetype #6
Tutorial: Pong / Paddle Game
This is the exact Pong / Paddle Game archetype from What Makes a Game? — already built and running below, you vs. a simple computer opponent. Play it, then swap the pre-built ball, colors, and difficulty using the panel underneath. You can't break the loop itself; that part is locked. Once you've tuned a version you like, you'll build this same architecture two more times: with Scratch's blocks, then from real scratch in JavaScript.
🗺️ The Architecture
Every tiny-loop game starts as a concept, then gets broken into a core loop, a systems list, and a structure — before anyone touches sprites or colors. Here's the Pong / Paddle Game's architecture:
The four systems, in order of execution every frame:
- Input system — reads the arrow keys (or mouse) and moves the player's paddle up/down.
- AI system — moves the CPU's paddle toward the ball's y position, but capped at a limited speed so it's beatable.
- Physics system — the ball moves every frame and reflects its direction off the top/bottom walls and either paddle.
- Scoring system — when the ball passes a side completely, the other player scores and the ball resets to center.
🎮 Play & Customize
Move your paddle (left side) with Arrow Up / Arrow Down, W / S, or the touch buttons below the game. First to the score goal wins the match.
💡 Click inside the game first — that gives it keyboard focus so ↑/↓ move your paddle instead of scrolling the page.
Tune the Game (limited, on purpose)
Notice what you can't change here: there's no field for "how bounce reflection works" or "how the CPU tracks the ball." That's the engine — the part every version of this game shares. You're only tuning content, not rewriting architecture. That's the limit, on purpose.
What the sliders actually touch in the engine: Ball Speed only sets the ball's starting velocity magnitude (1.5 + ballSpeed × 0.6) each time it resets — the bounce-reflection math (vx *= -1) runs identically regardless. CPU Difficulty is the cap on how many pixels per frame the CPU paddle is allowed to close in on the ball (clamp(dy, -aiSpeed, aiSpeed)) — the CPU always tracks the ball's exact position, this only limits how fast it's allowed to react.
👀 Peek at the Code
The game running above is this code — nothing hidden. It's split into two parts on purpose: a small config object you just edited with the panel, and a locked engine that reads it.
✏️ Config — this is what the panel above editsconst config = { ball: '🏐', bg: 'space', ballSpeed: 3, aiSpeed: 3, winScore: 5 };
👆 This block updates live — hit "Apply & Restart" above and watch the exact values change here. There's no separate "demo" version of the code; this is it.
🔒 Engine — locked, shared by every version of this gamefunction update() { // 1. player paddle follows held keys if (keys.up) playerPaddle.y -= 5; if (keys.down) playerPaddle.y += 5; // 2. CPU paddle chases the ball, capped at aiSpeed const dy = ball.y - cpuPaddle.centerY(); cpuPaddle.y += clamp(dy, -config.aiSpeed, config.aiSpeed); // 3. ball moves, bounces off walls and paddles ball.x += ball.vx; ball.y += ball.vy; if (ball.y < 0 || ball.y > H) ball.vy *= -1; if (collides(ball, playerPaddle) || collides(ball, cpuPaddle)) ball.vx *= -1; // 4. score when the ball fully passes a side, then reset if (ball.x < 0) { cpuScore++; resetBall(); } if (ball.x > W) { playerScore++; resetBall(); } }
🛠️ Now Build It For Real
You've played a working Pong game and seen exactly how it's built. Next, build this same architecture yourself — twice, in two different tools.
🧩 Step 1 — Build It in Scratch
The "Build the Loop with Blocks" section above already shows the exact scripts — backdrop, sprites, variables, and all four scripts, block by block, in Scratch's own category colors. Open a Scratch tab side-by-side and copy each script exactly; the game should come to life the same way it does here.
Open a blank Scratch project tab →Want more practice first? Scratch's official Pong tutorial builds a similar loop — a ball that bounces off walls and a paddle, with a climbing score.
Open the official Scratch Pong Game tutorial →