Game Design & Development · Tiny-Loop Tutorial · Archetype #3

Tutorial: Clicker Game

Click Events Score Counter Upgrades Pre-built Sprites

This is the exact Clicker Game archetype from What Makes a Game? — already built and running below. Play it, then swap the pre-built sprite, upgrade cost, and win goal 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 Clicker Game's architecture:

🌱ConceptClick the sprite to earn points, spend points to click for even more.
🔁Core LoopClick → score increases → afford upgrade → buy it → click again, faster.
🧩SystemsClick handler, score counter, click-power variable, upgrade shop.
🏁Win/LoseReach the score goal to win. There's no lose state — just progress.

The three systems, in order of execution on every click:

  1. Click system — detects a click on the target sprite and fires once per click (not held down).
  2. Score system — adds the current "click power" to the score, then checks the win condition.
  3. Upgrade system — spends score on an upgrade that permanently increases click power, and raises the next upgrade's cost.

🎮 Play & Customize

Click the sprite to earn points. Buy the upgrade when you can afford it to earn more per click. Reach the score goal to win.

Score: 0 +1 / click
+1 click power

Tune the Game (limited, on purpose)

Notice what you can't change here: there's no field for "how the upgrade math works" or "how clicking is detected." 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: Starting Upgrade Cost only sets the very first value of upgradeCost — the ×1.6 growth per purchase (Math.round(upgradeCost * 1.6)) is fixed either way, so a higher start just means every later upgrade costs proportionally more too. Score to Win only changes the number score is compared against; the +1-per-upgrade click power math never changes.

👀 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 edits
const config = {
  target: '🍪',
  bg:     'space',
  upgradeCost: 10,
  winScore: 100
};

👆 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 game
let score = 0, clickPower = 1, upgradeCost = config.upgradeCost;

target.addEventListener('click', () => {
  score += clickPower;                 // 1. click adds current power
  updateHUD();
  if (score >= config.winScore) endGame(true);  // 2. check win condition
});

upgradeBtn.addEventListener('click', () => {
  if (score < upgradeCost) return;   // can't afford it yet
  score -= upgradeCost;                // 3. spend score
  clickPower += 1;                  // permanently earn more per click
  upgradeCost = Math.round(upgradeCost * 1.6); // next one costs more
});
This is what "architecture" means in practice: the config is the part of the design doc you filled out in Lesson 1 (goal, mechanic, feedback). The engine is the part no one writes twice — the same click/score/upgrade systems power every clicker game from this one to Cookie Clicker itself.

🛠️ Now Build It For Real

You've played a working Clicker 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 three 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 tutorial builds a similar click-for-points loop with a shop/upgrade system.

Open the official Scratch Clicker Game tutorial →
Step 2 — Code It From Real Scratch (Lesson 2) Write this same click handler, score system, and upgrade math yourself in plain JavaScript — no engine, no blocks. ↩️ Back to the Archetype Grid Return to What Makes a Game? to try another tiny-loop archetype or the design workshop.