On this page
Create the cookie and score
Start a blank Scratch project. Draw your own cookie sprite and create variables for all sprites: Cookies, Cookies per click, Auto bakers and Baker cost. Show Cookies on the stage. Add a green-flag script that sets Cookies to 0, Cookies per click to 1, Auto bakers to 0 and Baker cost to 15.
On the cookie sprite, add “when this sprite clicked”, followed by “change Cookies by Cookies per click”. Test ten clicks: the score should be ten. A small size animation can give feedback, but keep the score change in one click handler so one click cannot trigger two rewards.
Add a shop and automatic cookies
Draw a second sprite labelled Buy baker. Its click script checks whether Cookies is greater than or equal to Baker cost. Inside that condition, subtract Baker cost from Cookies, add 1 to Auto bakers and set Baker cost to round(Baker cost × 1.15). If the condition is false, say how many cookies are needed without changing any variables.
On the stage, add a green-flag script with a forever loop: wait 1 second, then change Cookies by Auto bakers. One baker now gives one cookie each second. Keep this production loop in exactly one place; starting a new loop on every shop click causes unintended duplicate production.
Add upgrades and test the project
Create a click-upgrade sprite with its own price variable. Use the same affordability check, then increase Cookies per click after payment. Test a purchase with exactly the required balance and with one cookie too few. Check that Cookies never becomes negative and that the displayed price matches the next charge.
Restart with the green flag and confirm every variable resets once. This starter project has no persistent save or offline progression; add those only after the basic click and purchase loop works. Use your own artwork and project title. It is not an official Cookie Clicker port and cannot import official saves. See game versions to understand why similarly named Scratch projects can behave differently.
Prefer HTML and JavaScript?
Use our cookie clicker HTML code tutorial for a small working browser example with the same click, purchase and production loop. It is an original learning project with no official-game save compatibility.
