What You Will Build
Program a dragonfly that grows when it eats food, using variables and size effects. 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 change size by to make a sprite grow
- Track a size variable and link it to the sprite's appearance
- Make sprites hide and reappear at random positions
- Control a sprite with arrow keys
- Animate wings using costume switching in a loop
Step-by-Step Guide
- 1Add a sky or meadow backdrop.
- 2Add a dragonfly sprite with at least two wing-flap costumes.
- 3Set size to 30% and create a size variable set to 30 on start.
- 4Add a forever loop: next costume then wait 0.1 secs for the wing animation.
- 5Use arrow keys to move: when [up arrow] pressed → change y by 5 etc.
- 6Add three leaf sprites. When the dragonfly touches a leaf: change size by 5, hide the leaf.
- 7After 2 seconds, show the leaf at a new random position.
- 8If size reaches 100: play a fanfare sound and say [Fully grown!].
- 9Add a maximum size check: if size > 100 set size to 100.
- 10Test flying around and eating all the leaves.
Extension Challenges
Finished the main project? Push further:
- Add different foods — some grow the dragonfly, one shrinks it.
- Add an obstacle (a bird) that resets the size to 30 if touched.
- Add a hatching egg animation at the start.