Define the player and the hazard (7:11 mins) Copy

When driving Mars rovers, we have to be very intentional about how we move a rover across the harsh landscape to reach its destination. This means that the best path is not always the shortest path as we may need to evade treacherous areas or conditions. While the rover is meticulously monitored and controlled, the dangerous conditions on Mars can’t always be avoided.

A grainy black-and-white image shows a thin column of dust moving sideways beyond a distant ridge.

In the previous step, we set our game objects in motion, but our rover and the hazards should be moving differently.

  • First, we will define the properties specific to our rover, including how it moves and what happens if it collides with a hazard. Again, this can be imported from a separate file for cleanliness if preferred.
  • Observe how in this example, height is used to be sure the rover never drives off the game window.
  • Consider the kinds of hazards we might encounter on Mars, how they would behave, and how we might be alerted to their presence as you complete this next step and further define the behavior of hazards in your game. In our first pass, hazards had a fairly simple set of parameters. Feel free to add more complexities to them as you see fit.

About the image: This gif of a dust devil on Mars was created from images captured by NASA’s Curiosity rover in August 2020. The dust plume disappears past the top of the frame, so an exact height can’t be known, but it’s estimated to be at least 164 feet (50 meters) tall.

error: Content is protected !!