Create a video game that lets players explore the Red Planet with a helicopter like the one going to Mars with NASA's Perseverance rover! Use Scratch, a visual programming language and think like NASA space-mission planners to design your game!


Watch the Tutorial

See below for materials and step-by-step instructions. For more video tutorials and activities like this one, visit Learning Space.

Watch en Español: Seleccione subtítulos en Español bajo el ícono de configuración.

In this episode of Learning Space, you'll create a video game that lets players explore the Red Planet with a helicopter like the one going to Mars with NASA's Perseverance rover! | Watch on YouTube

Screengrab of Scratch with a window showing the helicopter backdrop options

Materials

Image showing the Scratch platform with the Mars Helicopter backdrop and sprite added

1. Get set up

  1. Download the Mars surface images and the Mars helicopter sprite image, and save them to a computer. Unzip the surface images zip file into a new folder. There are jpg and png versions of each file.
  2. On the Scratch website, click Create to begin a new project. (Sign in or create an account, if you want to save your work so you can revisit or redesign your game in the future.)
  3. Create a new backdrop by moving the mouse over the Choose a Backdrop icon in the Stage window and selecting Upload Backdrop. Pick the Mars surface image of your choice. The Stage area of the screen should now display your selected backdrop image. Click for an example (image).
  4. Create a new sprite by moving the mouse over Choose a sprite in the Sprite window and selecting Upload Sprite. Choose the helicopter sprite image. There should now be a helicopter placed over your backdrop image along with the original cat sprite. Click for example (image).
  5. Delete the existing cat sprite by clicking on it in the Sprites window and clicking the “x” in the corner.
  6. With the helicopter sprite selected, you’re ready to create the code that manages the game and controls the helicopter!
Animated screenshot of the helicopter flying on an example video game on Scratch

2. Make the Helicopter Fly

NASA’s Mars helicopter is a technology demonstration intended to prove that a small, lightweight helicopter can fly in the thin atmosphere of Mars. The helicopter on Mars won’t be controlled with joysticks or keyboards. But in the future, astronauts in orbit around Mars or on the surface of the planet could use remote controls to fly helicopters. Your game can use keys on a keyboard to make the helicopter fly.

Tasks

  1. Make the helicopter fly up, down, left and right on the screen using four different keys on the keyboard. Hint: See if a block in the Control section will help. Click for example (image).
  2. Specify how far the helicopter will move each time one of the keys defined above is pressed. Select a number that makes the helicopter movement appear smooth when the key is pressed and held. Hint: See if a block in the Motion section will help. Click for example (image).
  3. Make the helicopter stay oriented with its rotor on top no matter what direction it is traveling.
  4. Bonus: Create a script that uses sprite costumes to make the helicopter appear to rotate.
Animated screenshot of the helicopter taking off on an example video game on Scratch

3. Add a takeoff location

The Mars helicopter will travel to the Red Planet on the belly of the Perseverance Mars rover. After Perseverance lands, it will place the Mars helicopter in its first takeoff location on the surface of the planet. You can specify a takeoff location for your helicopter by creating scripts that place it at a certain location at the beginning of the game.

Tasks

  1. Create code that puts the helicopter in a specific location at the beginning of the game. Make sure it's starting on the ground, not in the sky!
  2. Bonus: Modify your landing code to make the helicopter start in a random location on the ground.
Animated screenshot of the helicopter landing in a marked landing ellipse on an example video game on Scratch

4. Add a landing site

The Mars helicopter will make up to five flights on Mars starting with a controlled vertical takeoff and landing. Later, its flights will become more complex, reaching heights of 10 to 15 feet and distances up to hundreds of meters.

Tasks

  1. Create a visible landing target on the backdrop image. You can draw a landing location with the backdrop editor, or add a sprite that will serve as a landing target. Avoid putting the landing target over large rocks that could damage the helicopter upon landing. While the real Mars helicopter won’t have a marked landing spot for its flights, your game players will need to know where to land.
  2. Bonus: Generate code that identifies an unmarked region as a safe landing area that game players must find by attempting to land in different regions. Remember, you'll want to place these unmarked regions in areas without large rocks!
Animated screenshot of a timer added to the example video game on Scratch

5. Add a countdown timer

NASA’s Mars helicopter will make incrementally longer flights, lasting up to 90 seconds. One constraint that limits the flight time is the amount of power stored in the helicopter's batteries. You can create a timer that counts down to the end of the flight and ends the game. Your timer should not be so short that the game is unplayable or unwinnable, but it should not be so long that there is no challenge to successfully playing the game. You may need to adjust your timer if you change your helicopter’s speed or the landing site.

Tasks

  1. Create a timer that counts from a set time down to zero. Hint: Create a Time variable that you can program to change. Click for example (image).
  2. Make gameplay stop when the timer reaches zero.
  3. Make a “Mission Over” message appear when the timer reaches zero.
  4. Make the timer start over when a player clicks the green flag to restart the game.
  5. Bonus: Develop code to bring the helicopter down to the ground regardless of where it is when the timer reaches zero.
Animated screenshot of a mission success message added to the example video game on Scratch

6. Indicate mission success!

The Mars helicopter is a technology demonstration mission. It will help NASA prove that a helicopter can fly on Mars, something that has never been done. Mission success for the Mars helicopter will be achieved when it makes its first controlled flight on Mars.

Tasks

  1. Create code that announces a successful mission once the helicopter safely lands on the landing site.
  2. Make gameplay stop when the landing occurs.
  3. Make a script that stops the mission-over script from running when mission success has been achieved.