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

Tutorial: Top-Down "Shooter"

Player Movement Projectiles Target Spawning Score & Win Pre-built Sprites

This is the exact Top-Down "Shooter" archetype from What Makes a Game? — already built and running below, kept nonviolent by design (pop balloons, zap viruses, spray out fires). Play it, then swap the pre-built sprites and pace 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 Top-Down "Shooter"'s architecture:

🌱ConceptAim and fire at targets before time or patience runs out.
→
🔁Core LoopMove → fire a projectile → it travels → hits a target → target disappears, score +1.
→
🧩SystemsPlayer movement, projectile spawner, target spawner, hit detection.
→
🏁Win/LoseReach the score goal to win. There's no lose state — just accuracy and speed.

The four systems, in order of execution every frame:

  1. Input system — reads held arrow keys to move the player along the bottom, and a key press to fire.
  2. Projectile system — each fire press spawns one projectile at the player's position that travels straight up until it hits something or leaves the screen.
  3. Target spawner system — keeps three targets drifting side to side near the top, respawning a new one in a random slot a moment after one gets hit.
  4. Hit detection system — checks every projectile against every target with AABB; on a hit, the target disappears, the projectile is removed, and the score increases.

🎮 Play & Customize

Move with ← / → or A / D. Fire with Space or ↑, a click on the game, or the touch Fire button. Targets drift, so lead your shots. The clock is running: hit the score goal as fast as you can.

Score: 0 0.0 s

Keys only work while the game has focus. Press P or Esc to pause.

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 targets respawn" or "how hits are 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 Projectile Speed actually touches in the engine: it's only how many pixels each projectile's y shrinks by per frame once it's already in flight (p.y -= config.projectileSpeed) — it doesn't touch how often you can fire (there's no cooldown; one key press is one projectile) or how close a projectile has to be to register a hit in collides(). Same fire rate and hit radius at every speed.

👀 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 = {
  theme:  'balloons',
  player: '🧑',
  projectileSpeed: 4,
  winScore: 15
};

👆 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
function update() {
  // 1. move the player from held keys
  if (keys.left)  player.x -= 5;
  if (keys.right) player.x += 5;

  // 2. fire spawns one projectile that travels straight up
  if (firePressed) { projectiles.push({ x: player.x, y: player.y }); firePressed = false; }
  projectiles.forEach(p => p.y -= config.projectileSpeed);

  // 3. targets drift and bounce; empty slots refill after a short delay
  targets.forEach(t => {
    t.x += t.vx;  if (t.x < 24 || t.x > W - 24) t.vx *= -1;
    if (!t.alive && --t.cooldown <= 0) respawn(t);
  });

  // 4. check every projectile against every target
  projectiles.forEach(p => targets.forEach(t => {
    if (t.alive && collides(p, t)) { t.alive = false; p.hit = true; score++; }
  }));
}
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 movement, projectile, spawner, and hit-detection systems power every top-down target game, whatever the theme.

🧪 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.

TweakFire cooldownProjectile system · two lines

Right now, mashing Space is the best strategy. Add a cooldown so every shot has to count. How long before it feels sluggish instead of tactical?

if (firePressed && cooldown <= 0) { fire(); cooldown = 15; }  // 15 ticks = ¼ second
cooldown--;
TwistLimited ammoChange the win condition

Give the player 20 shots. When they're gone, the game ends and the score is your accuracy (hits / shots). It's the same engine, but now the design rewards patience instead of speed.

TransformTargets fight backNew system: enemy projectiles

Every so often, a target drops a projectile of its own that falls toward the player. Add lives, and reuse the Catch game's collision check for incoming shots. With that one extra system, you've made a small Space Invaders.

🛠️ Now Build It For Real

You've played a working target 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 six scripts (using broadcasts to connect Player, Projectile, and Target), 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? Two official Scratch resources cover the pieces this loop is built from.

⚡ Step 2 — Code It From Real Scratch (Lesson 2) Write this same projectile system, target spawner, and hit detection yourself in plain JavaScript and HTML5 Canvas — no engine, no blocks.