Project 33 of 35  ·  Scratch Programming  ·  Module 3
Module 3

Lineup

Build a sorting challenge where players arrange sprites into the correct formation.

🍓  Open on Raspberry Pi Projects  ↗ Opens the official Raspberry Pi Foundation project — includes starter files and full step-by-step guide

What You Will Build

Build a sorting challenge where players arrange sprites into the correct formation. 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

  • Place sprites at random positions on stage start
  • Animate sprites gliding into a sorted formation on command
  • Implement drag-and-drop for manual repositioning
  • Check if the lineup is in the correct order
  • Score based on time taken and number of moves

Step-by-Step Guide

  • 1Create 6 character sprites with 2 costumes each (two different outfits or poses).
  • 2On start: place all 6 sprites at random x, y positions.
  • 3Add a Sort button. When clicked: glide 0.5 secs to x:(n*80 - 240) y:0 for each sprite (n = 1–6).
  • 4Add a Height Sort: arrange sprites from tallest to shortest based on a height variable.
  • 5Add a Colour Sort: group sprites by costume colour.
  • 6Add drag-and-drop: when this sprite clickedforever if mouse down: go to mouse-pointer.
  • 7When mouse released: snap to the nearest grid position.
  • 8Add a Check button: compare each sprite's x position to the expected order.
  • 9Show score: time taken + number of drag moves used.
  • 10Add an animated entry: sprites march in from the left edge one by one.

Extension Challenges

Finished the main project? Push further:

  • Add a musical chairs mode: sprites compete for fewer positions than there are sprites.
  • Add a countdown timer — the player must complete the sort before time runs out.
  • Build a team formation board where the player places athletes in a tactical layout.