Back to Class Challenge
Code Studio · Level 9

Mini Game Engine 🕹️

Time to be a game engine. Combine a class, an array, and a loop to run a tiny game — your player collects loot and the screen updates, exactly like every real game.

15-20 min Ages 9-12 Real Code JavaScript
Code Editor

Run a tiny game.

Example code
class Player {
  constructor(name) {
    this.name = name;
    this.items = [];
  }

  collect(item) {
    this.items.push(item);
    say(this.name + " collected " + item);
  }
}

let player = new Player("Bolt");
player.collect("star");
player.collect("key");
🧩 Tap to add code blocks — build a player, then collect loot
Name your player Bolt, Nova, Dragon, Unicorn, Cat, Dog… for an avatar. star key rocket …any other loot becomes a 📦 crate!
Game Screen

Your game, running live

PLAYER 0

Run your code to start the game…

INVENTORY (player.items)

Waiting for your game…