In this project, we continue the development of our Alien Intruders game by adding in 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'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 not moving yet, but at least they are displayed!

Here is what the code for this project should look like at this point (with new changes highlighted with arrows):

  1. We store the positions of the aliens in the variable alien_columns, which is a list of column numbers. Can you create this same list using the range() function?

  2. Instead of four aliens right next to each other, can you make three aliens that are separated from each other?

  3. The aliens start at the top row. Can you change this to have them randomly start in one of the top three rows?