NASA sends rovers to Mars to collect data and carry out scientific studies. The Perseverance Mars rover is designed to take that data collection one step further by gathering rock cores in sample tubes and leaving them on the surface for a future "fetch rover" to collect. The fetch rover would collect the samples and bring them to a Mars ascent vehicle – a rocket that would carry the samples from the surface to orbit around Mars – for eventual return to Earth. In this project, you will use Scratch, a visual programming language, to create a video game that simulates the way NASA collects samples on Mars!
Materials Computer with internet access Free Scratch account Mars fetch rover sprite – Download PNG Mars sample collection tube sprite – Download PNG Jezero crater surface images – Download ZIP
1. Get set up Download the Jezero Crater surface images, the Mars sample collection tube image, and Mars fetch 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. Pick the Jezero Crater surface image of your choice. The Stage area of the screen should now display your selected backdrop image. (See example image.)
Create a new sprite by moving the mouse over Choose a sprite in the Sprite window and selecting Upload sprite. Choose the Mars fetch rover sprite image. There should now be a rover placed over your backdrop image along with the original cat sprite. (See 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!
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. For rovers to visit more than one place on 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. (See 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. (See 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.
3. Add sample tubes for collection
Sample tubes contain valuable rock samples collected by the Perseverance Mars rover and left behind for a fetch rover to collect. You should add sample collection tubes to your game to provide destinations for your rover. By studying the backdrop images closely, you can identify areas that look interesting and place sample tubes in those spots.
Tasks
Add three or more sample tube sprites to visit during gameplay by placing the downloaded sample tube sprites to the backdrop by selecting Upload sprite the same way you did in Step 1.
Make the sample tube sprites disappear when they are visited by the rover. Hint: See if a block in the Control section will help. (See example image.)
Make the sample tube sprites reappear when players click the green flag to restart
the game.
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. (See 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.
5. Add a scoring system
Rover missions on Mars don’t have a scoring system. 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 collecting sample tubes. How points are totaled is up to you. You could also program your game to reduce point totals in certain scenarios (see Step 6, for example).
Tasks
Develop code to create a scoring system.
Increase the score by one or more points for each sample tube collected.
6. Add hazards
Space travel and other worlds are fraught with hazards. 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.
7. Add landing code Every Mars rover has to first land on the Red Planet before it can start exploring. 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.
` Credits
Nasa for this amazing activity
https://www.jpl.nasa.gov/edu/learn/project/code-a-mars-sample-collection-video-game/
My video
Comments