Code Studio · Level 12
Capstone Mini Game
The final boss. Combine everything — variables, loops, conditionals, functions, and classes — into one tiny playable game. You have the whole toolkit now.
Plan the final game.
Example code
class MiniGame {
constructor(title) {
this.title = title;
this.score = 0;
this.items = [];
}
collect(item, points) {
this.items.push(item);
this.score += points;
say("Collected " + item);
}
finish() {
if (this.items.includes("star") && this.score >= 10) {
say(this.title + " complete!");
} else {
say("Keep building your game.");
}
}
}
let game = new MiniGame("Robot Star Quest");
game.collect("star", 10);
game.finish();
Program result
- Run your code to see output.
Type real JavaScript, then run it.
Capstone starter ran.
You combined a class, score, inventory, methods, and a win rule in one program.
Open Capstone Builder