Create an interactive Scratch project that simulates customers visiting a shop, programming behaviors, responses, and simple transactions to practice coding and logic.



Step-by-step guide to Code Your Customers on Scratch
Step 1
Open scratch.mit.edu and click Create to start a new project.
Step 2
Click the Stage and choose or paint a shop backdrop with a counter and a door.
Step 3
Add a shopkeeper sprite and place it behind the counter.
Step 4
Add at least two customer sprites and give each a different costume then place them offstage near the door.
Step 5
For each customer sprite create a variable named budget for this sprite only and add a block when green flag clicked set budget to pick random 5 to 20.
Step 6
Create at least two item sprites for sale and for each item create a variable named price for this sprite only and set price to a number when green flag clicked.
Step 7
Create a global variable named currentPrice and program each item so that when the item is clicked it sets currentPrice to its price and broadcasts itemSelected.
Step 8
For each customer sprite add blocks so that when the green flag is clicked the customer waits pick random 1 to 4 seconds then shows and glides 1 second to the counter.
Step 9
For each customer sprite add a when I receive itemSelected block that checks if the customer is touching the counter and if so broadcasts askPrice.
Step 10
In the shopkeeper sprite add a when I receive askPrice block and make the shopkeeper say join "Price is $" currentPrice for 2 seconds.
Step 11
In the customer sprite add a when I receive askPrice block that waits 1 second then if budget >= currentPrice changes budget by -currentPrice broadcasts buy and says "Thanks" else says "I can't afford it" and glides 1 second out the door.
Step 12
In the shopkeeper sprite add a when I receive buy block that changes a shopMoney variable by currentPrice plays a sound and makes the bought item hide or show a sold look.
Step 13
Click the green flag to test the project and then tweak budgets prices and timings until customers enter ask and buy as you want.
Step 14
Share your finished interactive shop project on DIY.org.
Final steps
You're almost there! Complete all the steps, bring your creation to life, post it, and conquer the challenge!


Help!?
What can we do if we can't open scratch.mit.edu or have no internet?
Use the Scratch Desktop offline editor and follow the same steps—create the store backdrop, sprites, per-sprite variables (budget, price), the global currentPrice and broadcasts—then save the .sb3 file to upload or share later on DIY.org.
Why do customers sometimes not ask for the price or never trigger askPrice?
If the when I receive itemSelected check for 'touching the counter' fails, make the counter a separate sprite (not just part of the backdrop) or adjust your customer's glide coordinates so they overlap the counter sprite before broadcasting askPrice.
How can I adapt this activity for younger or older kids?
For younger kids pre-make the shopkeeper and item sprites, set simple fixed budgets and prices and remove some broadcasts, while older kids can add lists for inventory, random discounts, expanded shopMoney tracking and more complex broadcasts and conditionals.
What are easy ways to extend or personalize the shop project?
Add features like a receipt sprite, customer satisfaction variable, seasonal price changes tied to currentPrice, coin animations that update shopMoney when you broadcast buy, and use item costumes or hide/show to display a sold look.
Watch videos on how to Code Your Customers on Scratch
Facts about block-based programming and game design for kids
🤖 Agent-based models let you simulate many independent customers, each following simple rules to create surprising group behavior.
🧩 Scratch projects are built from colorful drag-and-drop code blocks, making programming logic easy to explore without typing.
🐱 Scratch's mascot is a friendly cat — Scratch was created at MIT and has a huge online community sharing projects.
🎯 Using randomness (like the 'pick random' block) makes customer visits and choices unpredictable and your shop more fun to play.
💳 You can model shop transactions in Scratch using variables and lists to track money, inventory, and receipts.


Only $6.99 after trial. No credit card required