Code Studio · Level 9
Game Engine Challenge 🏆
Build your own tiny game from scratch: a class that tracks a score, stores items, and prints a final status. Run it and watch your whole game play out.
Build your own game state.
Example code
class Game {
constructor(title) {
this.title = title;
this.score = 0;
this.items = [];
}
earn(item, points) {
this.items.push(item);
this.score += points;
}
finish() {
say(this.title + " complete!");
say("Score: " + this.score);
say("Items: " + this.items.join(" + "));
}
}
let game = new Game("Star Rescue");
game.earn("star", 10);
game.earn("key", 5);
game.finish();
🧩 Tap to add code blocks — design a game, earn points, finish it
🎯 Earn at least one item and call
star
key
rocket
finish() to win.
star
key
rocket
Your game, running live
GAME
—
SCORE 0
Run your code to start the game…
ITEMS
Waiting for your game…
🏆 Challenge complete! Your game engine runs.
You combined everything: a class blueprint, a method that updates a score number and an items array, and a finish method that prints the result. That's a real game loop.