Click to score points, then spend them on silly upgrades that make every blast worth more. Play it first โ
then build the blaster with real JavaScript using a variable, an action, and
if / then to unlock upgrades.
Play it
Blast the button!
๐ฏ Goal: blast to earn points, then buy all 5 upgrades to become the Ultimate Blaster!
Difficulty:
This is the kind of extra code that powers the level you picked โ try reading it!
0
points
+1 per blast
๐ Upgrade shop 0 / 5 owned
๐ You did it! You own every upgrade โ you're the Ultimate Blaster!
How the blaster works
A clicker game is built from three small coding ideas working together.
๐ฆVariableremembers your score
๐Actiona click adds points
๐If / thenunlocks upgrades
let score = 0;
let perClick = 1;
// this runs every time you click BLASTfunctionblast() {
score = score + perClick;
// when you reach 20 points, unlock an upgradeif (score >= 20) {
unlock("Auto-Blaster");
}
}
Now you code it
Code Lab: build the blaster
You're building the code that runs each time the button is blasted โ the inside of the
blast() function.
๐ How this Code Lab works
Read the ๐ฏ Mission goal โ it tells you what your code should do.
In Code blocks on the left, click a block to add it to your program on the right. The blocks run top to bottom.
Need to change the order? Drag a block up or down (or use the โ โ buttons). Tap ร to remove one.
Press โถ Run code, then blast the live button that appears to test what you built.
A green โ means you solved it โ a Next mission โ button shows up. A blue ๐ก is a hint to try again.
๐ก Tip: score remembers your points, and perClick is how much one blast is worth.