Code Studio · Level 9
Game Builder 🎮
Add real game actions. Each item your player collects is worth points — your method updates the score and the inventory, and the screen shows it live.
Build a player inventory.
Example code
class Player {
constructor(name) {
this.name = name;
this.score = 0;
this.inventory = [];
}
collect(item, points) {
this.inventory.push(item);
this.score = this.score + points;
say(this.name + " found " + item);
}
showStatus() {
say("Score: " + this.score);
say("Items: " + this.inventory.join(", "));
}
}
let explorer = new Player("Nova");
explorer.collect("star", 10);
explorer.collect("badge", 5);
explorer.showStatus();
🧩 Tap to add code blocks — build a player, collect for points
Name your player Nova, Bolt, Dragon, Unicorn, Cat, Dog… for an avatar.
star
badge/shield
key
star
badge/shield
key
Your game, running live
PLAYER
—
SCORE 0
Run your code to start the game…
INVENTORY
Waiting for your game…
🎮 Game builder complete!
Your method changed two kinds of state at once — it pushed an item into the inventory array and added points to the score number. That's the heart of every game.