Create a Moon or Mars exploration game using Scratch, a visual programming language. Think like NASA space-mission planners to design your game!
Materials
- Computer with internet access
- Free Scratch account
- Mars surface images – Download ZIP
- Moon surface images – Download ZIP
- Mars rover sprite image – Download PNG
- Moon rover sprite image – Download PNG
Project Steps
Step 1: Get set up
Step 1: Get set up
- Download the Moon or Mars surface images and the Moon or Mars rover sprite image, and save them to a computer. Unzip the surface images zip file into a new folder.
- 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.)
- Create a new backdrop by moving the mouse over Choose a Backdrop in the Stage window and selecting Upload Backdrop. Choose the Moon or Mars surface image of your choice. The Stage area of the screen should now display your selected backdrop image. Click for example (image).
- Create a new sprite by moving the mouse over Choose a sprite in the Sprite window and selecting Upload sprite. Choose the rover sprite image. There should now be a rover placed over your backdrop image along with the original cat sprite. Click for example (image).
- Delete the existing cat sprite by clicking on it in the Sprites window and clicking the “x” in the corner.
- With the rover sprite selected, you’re ready to create the code that manages the game and controls the rover!
Step 2: Make the rover drive
Step 2: Make the rover drive
NASA explores Mars with orbiters that travel around the planet, stationary landers on the ground and rovers that can travel many miles on the surface. Astronauts have also explored the Moon with a car-like rover – and might again in the future. For rovers to explore the Moon or Mars, they must be able to drive. Rovers on Mars aren’t 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 drive rovers. Your game can use keys on the keyboard to make the rover drive.
Tasks
- Make the rover move up, down, left and right on the screen using four different keys on the keyboard. Hint: See if a block in the Events section will help. Click for example (image).
- Specify how far the rover will move each time one of those keys is pressed. Select a distance that makes the rover 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).
- Make the rover rotate so it points in the direction of travel.
- Bonus: Make the rover move diagonally using keys other than the keys already assigned.
Step 3: Add science targets
Step 3: Add science targets
NASA sends rovers to Mars to collect data and carry out scientific studies. Astronauts on the Moon will drive rovers to areas of scientific interest. “Science targets” are the locations and objects on which these studies are carried out. You should create science targets to provide destinations for your rover. By studying the backdrop images closely, you can identify areas that look interesting and that you think scientists might want to study.
Tasks
- Add three or more science targets to visit during gameplay by placing additional sprites representing the targets on the backdrop image.
- Make the science target sprites disappear when they are visited by the rover. Hint: See if a block in the Control section will help. Click for example (image).
- Make the science target sprites reappear when players click the green flag to restart the game.
Step 4: Add a countdown timer
Step 4: Add a countdown timer
NASA’s missions to Mars and other destinations have a planned life expectancy. Some missions, including every Mars rover to date, have been extended and operated beyond their planned mission life expectancy, while others experience problems that shorten their mission. You can create a timer that counts down to the end of the mission 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 playing the game. As a bonus, you can create code to extend or shorten the planned mission time.
Tasks
- 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).
- Make gameplay stop when the timer reaches zero.
- Make a “Mission Over” message appear when the timer reaches zero.
- Make the timer start over when a player clicks the green flag to restart the game.
- Bonus: Develop code that will increase or decrease the amount of time on the timer by one or two seconds at random.
Step 5: Add a scoring system
Step 5: Add a scoring system
Rover missions on Mars don’t have a scoring system, and astronauts aren’t given points for science discoveries on the Moon. But the science they collect 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 reaching science targets. How points are totaled is up to you. You could also program your game to reduce point totals in certain scenarios.
Tasks
- Develop code to create a scoring system.
- Increase the score by one or more points for each science target visited.
Step 6: Add hazards
Step 6: Add hazards
Space travel is fraught with hazards, both in space itself and on planets and moons. From steep slopes and deep sand to sharp rocks and high radiation, there are countless ways a mission can be delayed or end unexpectedly. Program your game to include hazards that players need to avoid. Look for dark areas in your backdrop image. These shadowed regions are often steep slopes that a rover could get stuck on.
Tasks
- Develop code that identifies hazardous locations on the backdrop image.
- Add in undesirable outcomes that occur when the rover reaches hazardous locations. (For example, the game could stop, time might be taken away, points might go down, etc.)
- Make a “Hazard” message appear when players encounter a hazard.
- Make some hazards hidden and some visible.
- Bonus: Make a hidden hazard that changes location each time the game is restarted.
Step 7: Add landing code!
Step 7: Add landing code!
Every Mars rover had to first land on the Red Planet before it could start exploring, as will rovers on the Moon in the future. You can specify a landing site by creating scripts that place the rover at a certain location at the beginning of the game.
Tasks
- Create code that puts the rover in a specific location at the beginning of the game.
- Bonus: Modify your landing code to make the rover land in a random location on the backdrop image, or in a random location within a smaller section of the backdrop image.
Step 8: Take it farther!
Now that you’ve created your game, let others play it and suggest improvements! Also, check out this Mars rover game from NASA for more inspiration.
Lesson Last Updated: Nov. 6, 2024