JPL
Careers
Education
Science & Technology
JPL LogoJPL Logo
Education
NASA OSTEM
JPL LogoJPL Logo
Education
Code a Mars Helicopter Video Game

Student Project .

.

Code a Mars Helicopter Video Game

Jet Propulsion Laboratory https://www.jpl.nasa.gov/ Last Updated: Oct. 11, 2024
Subject
Technology
Time Required
30 - 60 mins
Grade Levels
3-8

Your browser cannot play the provided video file(s).

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

Materials

Screengrab of Scratch with a window showing the helicopter backdrop options
  • Computer with internet access
  • Free Scratch account
  • Mars surface images – Download ZIP
  • Mars helicopter sprite image – Download PNG (right-click and select "Save Link As ...")
  • Mars sample collection tube sprite image – Download PNG (right-click and select “Save link as…”)

Project Steps

  1. Step 1: Get set up

    Step 1: Get set up

    1. Download the Mars surface images, the Mars helicopter sprite image, the Mars helicopter sprite image, and the Mars sample tube 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!
  2. Step 2: Make the Helicopter Fly

    Your browser cannot play the provided video file(s).

    Step 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.
  3. Step 3: Add a takeoff location

    Step 3: Add a takeoff location

    After the Perseverance Mars rover landed on the Red Planet, it placed the Mars helicopter in its first takeoff location on the surface of the planet. You can specify a take-off 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.
  4. Step 4: Add a landing site

    Your browser cannot play the provided video file(s).

    Step 4: Add a landing site

    Just like helicopters on Earth, the Mars helicopter will need to land.

    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!
  5. Step 5: Add Mars Sample Collection Tubes

    Step 5: Add Mars Sample Collection Tubes

    The Perseverance Mars rover is depositing sample tubes filled with rock samples on the surface of the Red Planet that could be collected by Ingenuity-like helicopters for return to Earth on a small rocket. You can give players a task by adding Mars sample collection tubes that need to be collected.

    Tasks:

    1. Add two or more sample tube collection sprites to the game.
    2. Develop code that will cause the tubes to indicate they have been collected when the helicopter reaches them.
  6. Step 6: Add a countdown timer

    Your browser cannot play the provided video file(s).

    Step 6: Add a countdown timer

    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.
  7. Step 7: Add a scoring system

    Step 7: Add a scoring system

    Missions on Mars don’t have a point system, but the science collected is valuable, and some discoveries may be more exciting, interesting, or important than others. To determine how well players are doing while playing your game, you can develop a scoring system that includes points earned for collecting sample tubes. How points are totaled is up to you. You could also program your game to reduce point totals in certain scenarios.

    Tasks:

    1. Develop code to create a scoring system.
    2. Increase the score by one or more points for each sample tube collected.
  8. Step 8: Indicate mission success!

    Your browser cannot play the provided video file(s).

    Step 8: 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.

Lesson Last Updated: Oct. 11, 2024

K-12 Resources
Education Resources
Lesson Plans
Student Projects
Teachable Moments
Collections
Internships
JPL Internships
Explore Programs & Apply
Internships FAQ
News & Events
All Education News
All Education Events
About
JPL Education
K-12 Education
Higher Education
Informal Education
NASA OSTEM
Get the Latest from JPL
Follow JPL Education
More from JPL
About JPL
JPL News
Missions
Images
Virtual Tour
Careers
About JPL
JPL News
Missions
Images
Virtual Tour
Careers
Related NASA Education Sites
Space Place
Climate Kids
Kids' Club
Space Math
Universe of Learning
STEMonstrations
Basics of Spaceflight
NASA’s Eyes Interactives
NASA
Caltech
Privacy
Image Policy
FAQ
Feedback
Version: v3.1.0 - 409b2d2
Site Managers:David Seidel, Ota Lutz
Site Editor:Kim Orr