Next Customer Please
Next Customer Please
Next Customer Please
Step 1 Introduction
Make a shop app where the customer can buy items from your shop. The project will be in first-person view where
the player is a customer.
First-person view means that you don’t see your character on the screen, instead you see what they see.
You will:
Get inspiration
You are going to make some design decisions to create your character. See inside example projects in Scratch 2:
Next customer please! - Examples (https://scratch.mit.edu/studios/29611454/) Scratch studio.
Step 2 Your business idea
Open a new Scratch project (http://rpf.io/scratch-new) and look at the range of sprites and
backdrops that you can use. Spend some time thinking about your business idea.
Working offline
For information about how to set up Scratch for offline use, visit our ‘Getting started with Scratch’
guide (https://projects.raspberrypi.org/en/projects/getting-started-scratch/1).
You can always add more scenery later if you find that you need it.
An NPC is a non-player character that you can interact with in a game or interactive story. Can you think of
games you have played that have NPCs? Next time you play, think about how it was someone’s job to make
that character.
Add a sprite to represent the seller.
Create a variable
From the Variables blocks menu click the Make a Variable button.
Notice: The new name variable appears on the Stage and can now be used in the Variable blocks.
Click on your seller sprite and add code to set the variable to the name of your business:
when clicked
Drag your variable to position it on the Stage as part of the shop scenery.
Test: Make sure you can see your business name as the value of the variable on the Stage.
Click on your seller sprite and add a broadcast block. Creat a new message called next customer.
when clicked
Create a new script for your seller sprite to say Next customer please when they receive the
broadcast next customer.
Debug: You might find some bugs in your project that you need to fix. Here is a common bug.
You should use the set [name v] to () block to set the variable to your name. If you have already
added a script, check that you have typed your business name into the value and clicked the green
flag.
when clicked
Your shop needs items for sale. Each item will have a price
that will be added to a total variable.
You will need to keep track of how much your customer is spending.
Add a new variable called total for all sprites.
Click on your seller sprite and add a script to set the total to 0 when the project starts.
Type in the name of your variable. You can choose whether you would like your variable to be available
to all sprites, or to only this sprite. Press OK.
If you want to hide the variable on the Stage, uncheck the box next to the variable in the Variables
blocks menu.
set total to 0
Add a sprite for the first item you’re going to sell in your shop.
If you like, you can add a price to the costume using the text tool in the Paint editor. Or add a price to the
backdrop and position the item next to it.
Add a script to change the total by the price of your item when the customer clicks on the sprite.
change total by 10
It’s also a good idea to play a sound to give the customer feedback that they have added an item.
Scratch has a library of sounds that you can add to your sprites. Click on the Choose a Sound icon to
open the Sound Library:
To play a sound, hold your mouse cursor (or your finger, if you are using a tablet) over the Play icon:
Click on any sound to add it to your sprite. You will be taken straight back to the Sounds tab and you
will be able to see the sound that you have just added:
If you switch to the Code tab and look at the Sound blocks menu, you will be able to select the new
sound:
Test: Click on your item and check that the value of the total variable increases by the price of the
item, and you hear the sound effect. Click more times to see the total go up.
Click the green flag to start your project and make sure that the total starts at 0.
Add more items to your shop.
You can either:
Duplicate the first item and then add a new costume in the Paint editor
Add a sprite and then drag the when flag clicked script from the first item to your new item
Add a price label to the costume or backdrop if you are using them.
Click on your new Item sprite in the Sprite list then click on the Code tab.
Change the amount the total changes by to the price of your new item.
Test: Click the green flag to start your project and click on items to add them. Check that the total
increases by the correct amount each time you click on an item.
If you have added price labels, make sure they match the amount that gets added to the total, or your
customers will be confused!
Debug: You might find some bugs in your project that you need to fix. Here are some common bugs.
The total doesn't increase by the correct amount when I click on an item
Check that each item has a when this sprite clicked script that changes the total by the
correct amount for that item — you might have changed the price for the wrong sprite.
Check that you have used the change block and not the set block to change the total. You need to
use change to add the price to the total, you don’t want to set the total to the price of the item that
was just added.
Scratch has a library of sounds that you can add to your sprites. Click on the Choose a Sound icon to
open the Sound Library:
To play a sound, hold your mouse cursor (or your finger, if you are using a tablet) over the Play icon:
Click on any sound to add it to your sprite. You will be taken straight back to the Sounds tab and you
will be able to see the sound that you have just added:
If you switch to the Code tab and look at the Sound blocks menu, you will be able to select the new
sound:
set total to 0
set total to 0
Add a second If block for answer = cancel and inside it add code to cancel the order.
when this sprite clicked
set total to 0
set total to 0
set total to 0
set total to 0
else
You have quite a lot of sprites in your project. Make sure the when this sprite clicked script is
on your seller sprite.
Tip: If you have added it to the wrong sprite, you can drag the code to the seller sprite, then delete it
from the other sprite.
Make sure your say block has the total variable block, not the word total.
set total to 0
not:
change total by 0
Tip: Compare your code with the code examples. Are there any differences that shouldn’t be there?
To add a sprite to your Backpack, drag the sprite from the Sprite list to the Backpack. This will store the full
sprite in your Backpack, including all of its costumes, sounds, and scripts.
To add a backdrop to your Backpack, select the Stage pane and click on the Backdrops tab, then choose
the backdrop that you want and drag it to your Backpack.
To use an item in your Backpack in another project, open the project and drag the item from the Backpack
to the correct pane or tab.
To delete an item in your Backpack, find the item in the Backpack tab, then right-click (or on a tablet, tap
and hold) on the item and select delete.
You can hide your Backpack when you are not using it. To do this, click on the Backpack tab at the bottom
of the screen.
Do you think your checkout person (or machine) should ask more questions?
You can add ask blocks to your seller’s when this sprite clicked script and say different things
depending on the customer’s response.
You could ask whether the service was good, or if they’re having a nice day. Or something specific to
your shop, like “What are you going to cook?”
ask Did you find everything you wanted today? and wait
else
Debug: Check that you have spelled the options correctly in your code and in your answer. It’s OK if
you use capital letters, so “Yes” and “YES” will match “yes”.
Add multiple questions to create a chatbot or non-player character that you can talk to.
when clicked
forever
go to front layer
Then you’ll need to add code to each Item you have for sale to make them glide to the container
when they are clicked:
go to front layer
hide
change total by 12
show
If you don’t want the container there all the time, you can add scripts to make it show and hide at the
right time:
when I receive next customer
wait 1 seconds
show
Test: Try your project and make sure items glide to the container and hide.
Debug: Check your scripts carefully and make sure you have updated all of your Item sprites. You can
look at Cool Shirts (https://scratch.mit.edu/projects/528697069/editor) if you need to see a
working example.
The Ice cream project shows the ice cream as the customer chooses their options.
broadcast 1 scoop
Then the sprite you want to show or change needs to respond to that message:
You may also want to change or hide the sprite for a new customer:
If you have multiple items, then you will need to add more messages and scripts to to receive them.
Have you noticed that your customer can add items after they have started to check out?
If you want to stop the customer adding items when they are at the checkout, you can add a shop
variable and use it to control when items can be added.
Add a variable called shop for all sprites. You will set this to true when the customer is in the shop
and false when they are at the checkout.
Select your seller sprite. Update the when flag clicked script to allow shopping when your
project starts:
Now add a block to change the shop to false at the beginning of your seller’s when this sprite
clicked script:
And a block to set the shop variable back to true at the end of the same script:
Now you need to update the items you sell to check the shop variable:
change total by 10
You will need to do this for every item you sell in your shop.
Test: Click the green flag then try shopping. Check that you can still add items and checkout, but you
can’t add items once you have started checking out.
Debug: Check your code really carefully. You can look at the Space Fruit (https://scratch.mit.edu/p
rojects/528696418/editor) project if you need to see a working example.
Save your project
Upgrade your project
If you have time you can upgrade your project.
Here are some ideas you could try:
Click on the Add projects button. You can add yor own project by selecting it from the list at the bottom of the
page.
You can also add projects your friends have created. Ask them to share their project and give you the link. Type
or paste the link into the url box, then click the Add by url button.
The url box underneath the 'Add projects'
button and the 'Add by url' button.
Share your project and send a link to people you know. The whole Scratch community will also be able to find your
project and try it out.
Share your Scratch project
Please make sure that you do not share any personal information about yourself when sharing your Scratch
projects.
If you like, you can add instructions in the Instructions box, to tell other people how to use your project.
You can also fill in the Notes and Credits box: if you have made an original project, you can write some
short comments, or if you have remixed a project, you can credit the original creator.
Click the Copy Link button to get the link to your project. You can send this link to other people by email or
text, or on social media.
Scratch provides the ability to comment on your own and other people’s projects. If you do not want to allow
people to comment on your project, you should turn off commenting. To turn off commenting, set the slider
above the Comments box to Commenting off.
Why not invite your friends to create a project? Let them know how you had fun.
If you have a Scratch account, and have shared your Next customer please project, keep an eye out for
comments that others may make about your creation. Feedback is a great way to reflect on your work. Ignore any
comments that are unhelpful or irrelevant.
If you are happy and feel safe to allow people to write comments on your project, you can leave the first
comment:
If you think a comment or project is mean, insulting, too violent, or otherwise inappropriate, click the Report
button to let the Scratch Team know about it. To report a comment, click the Report button above the
comment. To report a project, click the Report button on the Project Page:
If you want to have more fun exploring Scratch, then you could try out any of these projects (https://projects.ra
spberrypi.org/en/projects?software%5B%5D=scratch&curriculum%5B%5D=%201).