Step 3: Move mine sweeper using xCoord

So far we’ve been able to increase or decrease the xCoord variable using tilts and show the value using showNumber. Now let’s use the xCoord position to actually draw our mine sweeper and see where it is on the map!

In this step you’ll…

  • Turn LEDs on to show where your mine sweeper is
  • Refresh the screen to clear unused LEDs
  • Slow down the movement to make it easier to control

Turn on LEDs to show where our sweeper is

Clear LEDs when our sweeper moves away

Add a pause to slow down the movement

Next up…

You may notice that the mine sweeper “escapes” from the map. Why is that? In the next step we’ll fence it in and prevent it from leaving the screen.