What You Will Build
Simulate a queue management system using variables, broadcasts and animated sprites. Follow the guide below to build the project, then open the official Raspberry Pi page for starter files, worked examples and extra help.
🍓 This project is on the Raspberry Pi Foundation website. Click the orange button above to access the full guide, starter Scratch project and extension activities on projects.raspberrypi.org.
What You Will Learn
- Use a queue variable to track who is being served
- Animate customers walking to a counter using Glide
- Use broadcast to trigger each customer's turn
- Display the current number being served
- Count remaining customers in the queue
Step-by-Step Guide
- 1Create a shop or bank counter backdrop.
- 2Add 5 customer sprites and position them in a line off to one side.
- 3Create variables: current (who is being served) and queue (total waiting).
- 4Set queue to 5 and current to 0 on start.
- 5Add a cashier/counter sprite. When clicked: broadcast [serve] and change current by 1.
- 6Customer 1: when I receive [serve] → if current = 1 → glide to counter position → wait 2 secs → glide away.
- 7Repeat this logic for each customer (current = 2, 3, 4, 5).
- 8Show say (join [Now serving: ] (current)) on the cashier sprite.
- 9Decrease queue by 1 each time a customer is served.
- 10Show a Closed sign when queue = 0.
Extension Challenges
Finished the main project? Push further:
- Add random service times using wait (pick random 1 to 4).
- Add a priority customer who jumps the queue when Button A is pressed.
- Add a satisfaction meter that drops if customers wait more than 5 seconds.