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 (or focus it and press Space) to earn points. Buy the upgrade when you can afford it to earn more per click. Reach the goal in as few clicks as you can. When you buy each upgrade is the whole strategy.

Score: 0 +1 / click0 clicks
+1 click power

Tune the Game (limited, on purpose)

Content settings change how it looks and apply instantly. Rule settings change how it plays, so the round restarts.

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. Change anything in the panel and the matching value flashes 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.

🧪 Remix Challenges

The panel can only turn the knobs the engine exposes. To change the rules, you change the engine. Each challenge edits one system. Try them in your own copy once you've built it in Lesson 2.

TweakCritical clicksScore system · one line

Give every click a 10% chance to count double. The average barely changes, but the feel changes a lot. Randomness is one of the cheapest sources of excitement in game design.

score += clickPower * (Math.random() < 0.1 ? 2 : 1);
TwistAn auto-clickerNew upgrade that works over time

Add a second shop item that earns points every second without clicking. Now there are two things to spend on, and the question becomes "which one first?" That's the whole idle-game genre in one timer.

setInterval(() => { score += autoPower; updateHUD(); }, 1000);
TransformPrestigeA loop around the loop

When you hit the goal, offer a choice: keep going, or reset everything to zero in exchange for a permanent ×1.5 on all future points. You've built a second, slower core loop that wraps around the first one. Most long-running clicker games are built this way.

🛠️ 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.