SPACE INVADERS 4
In this project, we continue the development of our Space Invaders game by adding in the aliens.
I/O (Input/Output) RaspberrySTEM Cell
LED Matrix RaspberrySTEM Cell
Accelerometer RaspberrySTEM Cell
Having issues? Check out the Troubleshooting Guide.

In this project, we're going to add our aliens into the code.

The first thing we'll want to do is keep track of the aliens. We're going to have four aliens in our game (you're welcome to change that if you'd like), and we'll need to keep track of both what columns they are in and what row they are in at any given time.

We'll do that by adding a list to track their columns (they'll each be in their own column) and a variable to track their row (they'll all be in the same row). We'll start the aliens at the top of the display (the height of the display minus 1):

Next, we need to add code to draw the aliens each time through the loop:

The aliens are moving yet, but at least they are displayed!

Here is the full project at this point:

home | prev | next