Level 3: Swarms, Schools & Flocks
| Course: Scratch Programming | Level: Level 3 | Project 16 of 35 |
Official Raspberry Pi Project
This lesson is based on the official Raspberry Pi Foundation project. Open it alongside this guide to access the starter project, step-by-step instructions and community remixes.
### [🍓 Open "Swarms, Schools & Flocks" on Raspberry Pi Projects →](https://projects.raspberrypi.org/en/projects/swarms-schools-flocks)
How to use it: Click the link above, then click See Inside on the Scratch project to explore the finished version. Use Remix to get your own copy to edit.
What You Will Build
Simulate flocking behaviour with sprites that follow simple emergent rules.
What You Will Learn
By the end of this project you will be able to:
- Use Events blocks to start scripts and respond to clicks
- Combine Motion, Looks and Sound blocks to create behaviours
- Use variables to track game state and scores
- Apply the specific Scratch concepts introduced in Level 3
You Will Need
| Item | Details |
|---|---|
| 🌐 Browser | Any modern browser — Chrome, Firefox or Edge |
| 🔶 Scratch account | Free at scratch.mit.edu |
| ⏱️ Time | Approximately 30–45 minutes |
| 📋 Starter project | Available via the Raspberry Pi link above |
Step-by-Step Guide
- Create an ocean or sky backdrop.
- Create one fish or bird sprite with a simple design.
- Use the
create clone of [myself]block to create 20 clones when the flag is clicked. - Give each clone a random starting position and direction.
- In a
foreverloop on each clone:move [2] steps,if touching edge: turn [180] degrees. - Add separation: if touching another clone, turn slightly away.
- Add alignment: gradually match direction to nearby clones.
- Add cohesion: slowly move towards the average position of nearby clones.
- Adjust the three rules’ strengths using variables (sliders).
- Observe how complex group behaviour emerges from simple individual rules.
Extension Challenges
Try these after completing the main project:
- Add a predator sprite that clones flee from.
- Add food sources that attract the flock.
- Try with 50 or 100 clones and observe the difference.
Reflection Questions
- Which Scratch blocks did you use most in this project?
- What would you add or change if you had more time?
- How could you reuse the ideas from this project in a different context?
Share Your Work
When your project is complete, click Share in Scratch and post the link to your class or the Techbase community.
| ← Back to Scratch Course | Next: Lesson 17 → |