Back to Capstone Builder
Code Studio · Level 12

Capstone Challenge

Build your own mini game using a class, at least one array, methods, score, and a win rule.

10-15 min Ages 9-12 Challenge JavaScript
Code Editor

Build your final game.

Example code
class AdventureGame {
  constructor(hero) {
    this.hero = hero;
    this.score = 0;
    this.items = [];
  }

  collect(item, points) {
    this.items.push(item);
    this.score += points;
  }

  play() {
    this.collect("star", 10);
    this.collect("shield", 5);

    if (this.items.includes("star") && this.score >= 15) {
      say(this.hero + " wins the adventure!");
    } else {
      say(this.hero + " keeps exploring.");
    }
  }
}

let finalGame = new AdventureGame("Nova");
finalGame.play();
Output

Program result

Robot ready to speak your strings

Type real JavaScript, then run it.