In this project, we'll continue animating the aliens.

The hardware setup for this project should be the same setup that was completed for the project. Here's a reminder:

In this project, we'll start with our code from the last project (where we moved the aliens to the right), and we'll add moving the aliens back to the left and increasing the speed as they get closer and closer to the bottom of the LED Matrix screen.

To do this, we'll need to create two new variables to track the direction of the aliens (+1 or -1) and the speed of the aliens. Every time the aliens get to the edge of the screen, we'll move them down one row, and increase the alien speed. If the alien's row ever reaches 0, the aliens have won — ouch!

Here is what the code for this project should look like at this point (with new changes highlighted with arrows) — give it a try, and you should now see the aliens going back and forth, and marching down one row on each pass:

  1. Can you have the aliens start on the right side of the display (instead of the left)?

  2. Can you increase the starting alien speed? How fast can you increase it and still win the game?

  3. Our aliens move back and forth across the screen. Can you instead have them always move to the right, and when they hit the right side of the screen, restart them back at the left side?

  4. Can you add a second row of aliens?