Simple and addictive, the classic clicker game is easy and fun for everyone in the family Our party-themed Cookie Clicker shows kids how to make a clicker game on Scratch that displays a score counter. In this game, kids bake cookies with every click and watch their cookie count increase. The goal is to bake 999 cookies. Try this easy Scratch tutorial for kids to customize your own clicker game.
You can also learn to code from the experts in our top-rated Scratch coding classes.
Complete this Scratch tutorial for kids to build a Cookie Clicker game.
Play and remix the Cookie Clicker game now.
Table of Contents
- Step 2: Add a backdrop
- Step 1: Create a new Scratch project
- Step 3: Draw the cookie sprite
- Step 4: Add game logic to increase the cookie count
- Step 5: Animate the cookie click
- Step 6: Create the ones counter
- Step 7: Create the tens counter
- Step 8: Create the hundreds counter
- Step 9: Stop the counter at 999 cookies
Scratch Tutorial: Cookie Clicker
What you need:
- Scratch account: Create a free Scratch account
No coding experience is necessary for this Scratch tutorial. Beginner-friendly for kids ages 8 and up. Give it a try!
How To Make A Cookie Clicker Game On Scratch
Step 1: Create a new Scratch project
Let’s start by creating a new project.
- Visit https://scratch.mit.edu/
- Login to your account
- Click on the “Create” button at the top
- A new project will open, rename your project to Cookie Clicker
- Hover over the cat sprite and click the trash can to delete it
A new project will open up and you will see the Scratch interface.
Hint: You can also remix shared projects by clicking the green Remix button on the project page.
Step 2: Add a backdrop to your game
Now we can code our clicker game! In the new project, we can add a background to our game.
- Click the “Choose a Backdrop” icon
- Search for the “Party” backdrop and click to add it
The backdrop will appear in the preview screen and sets the scene for your game.
Hint: Choose any backdrop from the library or upload your own to fit your game design.
Step 3: Draw the cookie sprite
Every clicker game needs a clickable object. For this game, draw a cookie sprite using the Paint option.
- Hover over the “Choose a Sprite” icon and select “Paint”
- Draw the base of the cookie by clicking the circle tool. Click on the artboard and drag the mouse to create a circle.
- Change the color of the circle using the color selector
- Draw smaller circles with the circle tool to decorate the cookie
- Position the cookie on the background in the preview area
- Click on the Code tab and rename the sprite to “cookie”
The cookie sprite should now be visible. However, nothing happens when we click the cookie.
We’ll add that next, keep going!
Hint: Draw or select any sprite you want to fit your game design.
Step 4: Add game logic to increase the cookie count
Every time we click on the cookie, we bake one cookie for the party. So, the number of cookies increases by one with every click. We’ll use a variable to represent the increasing number of cookies.
- Go to the variables category and right-click the “my variable” block
- Click “Rename Variable”
- Rename the variable “cookies” and click ok
- Check off the “cookies” variable
The variable counter will now appear in the preview screen. We should start the number of cookies at 0 when the game starts.
- On the cookie sprite, add the “When Green Flag Clicked” block from the Events category
- Add a “Set cookies to 0” block from the Variables category
- Go to the Events category and select a “When this sprite clicked” block
- Underneath that, add a “Change cookies by 1” block from the Variables category
Click the green flag to test your game. The variable “cookies” should start at 0 and increase every time you click the cookie sprite.
Good job so far, let’s keep going!
Hint: You can add other sprites that increase the number of cookies by different amounts.
Step 5: Animate the cookie click
The cookie is pretty boring, let’s animate the cookie when it’s clicked by making the size of the cookie change.
- On the cookie sprite, add a “When this sprite clicked” block from the Events category
- Go to the looks category and add a “change size by 5” block. Increase the size slightly when we click.
- Add a “wait” block from the Control category and update the time to 0.05 seconds
- Return this sprite to its original size. Select “set size to 100%” from the Looks category.
Try it out by clicking the Cookie sprite. Do you see the animation working? Great job!
Hint: Change the animation by increasing the size or wait time.
Step 6: Create the ones counter sprite
The counter is made up of three different sprites. Let’s start with the sprite that represents the ones.
- Click on the “Choose a Sprite” icon
- Search for the “Glow-0” sprite and click to add it
- Rename this sprite “ones”
- Position and resize it in the preview to fit your theme
Now, we’ll add costumes for numbers 0 through 9 to the same sprite.
- Click on the “Costumes” tab
- Click the “Choose a Costume” button
- Add a costume to represent numbers 1 through 9, we are using Glow-1 through Glow-9
Now we can add code to connect the “ones” sprite to the cookie clicks. Start with the cookie.
- On the cookie sprite, add a “broadcast” block
- Click “New message” in the dropdown and name it “count”
The sprite changes costumes each time the cookie is clicked.
- On the ones sprite, add a “when green flag clicked” block
- Add “switch costume to Glow-0” to start with the 0 costume
- Use the “when I receive count” block to get the message
- Then, add “next costume”
You should see the first part of your counter on your screen. Click the cookie 9 times and watch it change!
But, it doesn’t go past 9, so we’ll add the rest of our counter in the next step.
Hint: You can draw or choose your own number sprite, just make sure to include costumes for numbers 0 to 9.
Step 7: Create the tens counter sprite
We have a sprite to represent the ones, now let’s add another sprite to represent the tens.
- Right-click on the “ones” sprite and click duplicate
- Position the sprite in the preview and rename this sprite “tens”
- Add an if-then loop from the Control category around the “Next costume” block.
- Inside the loop, add the equals block from “operators”. On the left, add a “mod” block and, on the right, use 0.
- Inside the mod block, add the “cookies” variable on the left and use 10 on the right. The complete formula (cookies mod 10 = 0) means that if the number of cookies is divided by 10, the remainder is 0.
Hint: Double-check that your counter matches the tens number in the “cookies” variable.
Step 8: Create the hundreds counter sprite
After that, create one more sprite to represent the hundreds.
- Right-click on the “tens” sprite and click duplicate
- Position the sprite in the preview and rename this sprite “hundreds”
- Inside the mod block, change the 10 to 100. The complete formula (cookies mod 100 = 0) means that if the number of cookies is divided by 100, the remainder is 0.
Click the green flag to reset your game, then click on the cookie to watch the numbers increase!
Hint: Double-check that your counter matches the hundreds in the “cookies” variable. Then uncheck the “cookies” variable to hide it from the screen.
Step 9: Stop the counter at 999 cookies
The goal is to bake 999 cookies, so when we reach that number the counter should stop.
- Select the cookie sprite
- Add an if-then loop, before “change cookies by 1”
- Add an equals condition, use 999 on the left and cookies on the right
- Inside the loop, add “stop all” from the control category
Click the sprite to watch the counter in action.
Hint: Use additional if-then statements to add effects and bonuses at different cookie counts.
With that final step, your Cookie Clicker game is complete! Play Cookie Clicker game.
If you want to let other people see your project and remix it, click the “Share” button at the top.
Add upgrades to your clicker game!
Bonus #1 – Add sound effect to the cookie click
Scratch has a number of sound effects and songs you can add to your project. Let’s play a sound each time we click on the cookie.
- Select the cookie sprite and go to the “Sounds” tab
- Click the “Choose a Sound” button on the bottom left
- Find the sound “Suction Cup” and click to add it
The sound has been created, now add the code the play the sound.
- Click on the Code tab
- Add the “start sound” block and choose “Suction Cup” under “when this sprite clicked”
Press the green flag and click your cookie to hear the sound!
Hint: Select any sound or even record your own to match your game’s theme.
Bonus #2 – Add a balloon animation at 999 cookies
Celebrate when the player successfully bakes 999 cookies! In this game, we show a floating balloon animation.
Every time we click, we’ll check to see if we’ve made enough cookies. Once we reach 999, we will send a message that the cookies are done and the party is on.
- Select the cookie sprite
- Inside the “if 999 = cookies” loop, add a broadcast block
- Click “New message” in the dropdown and call it “party”
- Underneath that add a “wait” block and change it to 2 seconds. This is how long our animation will play.
Next, add the balloon sprite that receives the message and performs an action.
- Click the “choose a sprite” icon, find the “Balloon1” sprite, and click to add it
- Rename it “balloons” and resize it in the “Size” field to 300
- Add a “when green flag clicked” block
- Then, use a “hide” block from the Looks category
Finally, add the code that makes the balloon float.
- Add the “When I receive” block and select “party”
- Add “start sound” and select “Clapping”
- Position the sprite with “go to x: 0 and y: -275”
- Underneath, add the “show” block to make the balloon visible
- Move it to the top using “glide 2 seconds to x: 0 and y: 275”
Your animation should work now!
To test it, update “if 999 = cookies” on the cookie sprite to “if 2 = cookies”. Then click the cookie to view the animation play. Change it back when you’re sure it works.
Hint: You can add any effect when you reach 999 cookies, just add it inside the “if 999 = cookies” loop.
Discover More Clicker Games on Scratch
You can find a lot of clicker games in Scratch to use for ideas and inspiration. You can also remix them to see the code inside. This is a great way to expand your knowledge and the kinds of games you can build in Scratch.
These are some of the top clicker games in Scratch.
Pokemon Clicker (51834 hearts)
Click your way to getting every pokemon in this popular Scratch clicker game. Keep clicking to get points that you can use to upgrade your pokeballs, and collect popular pokemon to become the very best.
Planet Clicker (31326 Hearts)
Click on the planet to generate energy. This game features a store to buy upgrades and add energy. Through your username, it also keeps tracks of your stats like clicks and time played that you can access in the menu.
Roblox Clicker #Games #All (25716 Hearts)
This Roblox Clicker in Scratch lets you generate dummy Robux with every click. You can use in-game codes for more Robux and even customize your clicker with different skins.
Cookie Clicker (24525 Hearts)
A simple cookie clicker with upgrade options all on one page. The game uses cloud variables for an auto-save functionality that lets you save your game and come back to keep clicking.
Money Clicker (23267 hearts)
Click your way to a fortune in the Scratch Money Clicker and get help by hiring employees, building companies and factories, and digging mines. This game has a clean design and scrolling feature for the upgrades.
Minecraft Clicker (17770 hearts)
Minecraft-themed clicker game where you click a building block to earn points. You can also buy upgrades to earn points quicker, like hiring the miner for help.
See more of the best Scratch games.
Get More Fun Scratch Tutorials
Keep coding with more fun Scratch tutorial for kids.
Download Free Printable Scratch Coding Tutorials PDF
Get the Rocketship Landing game and Flying Space Cat Scratch tutorials in a printable format.
Try a Scratch Coding Class for Kids
Once kids complete the Cookie Clicker game they can customize it endlessly. Completing this tutorial is just one way that kids can learn about coding in Scratch.
If this tutorial inspired your child to learn more coding, try a Scratch coding class at CodeWizardshQ. Our elementary school coding program is designed to teach kids, ages 8-11, how to think like programmers while building fun, interactive projects. It starts by teaching fundamental coding concepts in Scratch and then advances to text-based languages like JavaScript and Python. Classes are live, online so they’re fun and engaging for kids while being convenient for parents.
Learn more and join our top-rated Scratch classes for kids.