What You Will Build
Build a ghost-hunting action game with collision detection, scoring and a time limit. 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
- Move a ghostbuster sprite with the mouse or arrow keys
- Detect collision between hunter and ghost using touching sprite
- Track score with a variable and display it
- Add multiple ghost types with different point values
- Implement a countdown timer to end the game
Step-by-Step Guide
- 1Create a haunted house backdrop.
- 2Add a ghost sprite and a ghostbuster sprite.
- 3Ghost: forever → go to random position → wait (pick random 0.5 to 2) secs.
- 4Ghostbuster: forever → go to [mouse-pointer].
- 5If ghostbuster touching [ghost]: change score by 1, play zap sound, move ghost to new position.
- 6Create a 30-second countdown timer. When it hits 0: stop all and show final score.
- 7Add 3 ghost types using costumes: slow ghost (1 pt), fast ghost (2 pts, smaller wait), decoy ghost (-1 pt).
- 8Use pick random to assign a random costume to each ghost repositioning.
- 9Add a lives variable — if the decoy ghost is caught, lose 1 life.
- 10Add a high score variable that only updates when the current score is higher.
Extension Challenges
Finished the main project? Push further:
- Add a power-up that freezes all ghosts for 3 seconds when collected.
- Add boss ghosts that need 3 hits to defeat.
- Create 3 different haunted locations as level backdrops.