Python Asteroids+Invaders on GitHub

My keyboard tray Jira is getting too messy. I’ll clean it up and go to a much more high-tech solution. Also: a tiny tweak to screen layout. Also: robots


The glue on the sticky notes gets dry, I get spillage on them, and I can’t use the tray for anything useful, like a sandwich. Many of the things on the tray will never be done, and some of them I don’t even remember clearly enough to know what to do about them.

So let’s clean things up and go to a more high-tech solution: I’m going to make a jira tab in the project and put them in there, in text form. THen I can sort the list, edit it, pat it, prick it, mark it with a D for done, whatever.

I typed in the raw list from the tray, unsorted. There were also some ideas in earlier articles. Ah, yes:

  1. Scoring
  2. Saucer
  3. Two Players
  4. Bottom Line Damage

And you know what? PyCharm can fix list numbering in Markdown files. I love this program! Here’s the whole thing as of now:


  1. Scoring
  2. Saucer
  3. Two Players
  4. Bottom Line Damage
  5. Study pytest fixtures
  6. Better testing around startup
  7. gunner magic number radius
  8. game accept coins refers to Asteroids
  9. Star field
  10. improve shipmaker interact_with_asteroid
  11. simplify saucer (asteroids)
  12. test check-firing keys
  13. movable location?
  14. make pygame template with game class?
  15. See article 147 N.B. test missile point time t???
  16. rename Fleets and Asteroids_tick
  17. Robot move is not round trip (robot???)
  18. Incremental Aim Adjust?
  19. Use Nullables per James Shore?
  20. Events ala Rickard Lindberg?
  21. doctest??

Commit: Jira

Most of those are meaningful to me, and some of them probably even to Faithful Readers. I am tempted to break the list up into a few sections, at least things to code and things to study. Easily done:



  1. Saucer
  2. Two Players
  3. Better testing around startup
  4. gunner magic number radius
  5. Star field
  6. improve shipmaker interact_with_asteroid
  7. simplify saucer (asteroids)
  8. test check-firing keys
  9. movable location?
  10. See article 147 N.B. test missile point time t???
  11. rename Fleets and Asteroids_tick
  12. Robot move is not round trip (robot???)
  13. Events ala Rickard Lindberg?


  1. Scoring
  2. Bottom Line Damage
  3. Incremental Aim Adjust?
  4. game accept coins refers to Asteroids


  1. make pygame template with game class?


  1. Study pytest fixtures
  2. Use Nullables per James Shore?
  3. doctest??

Commit: Jira Update.

Some Actual Work?

OK that’s way more mechanism than I need, but it’ll keep the ideas with the program, and keep the keyboard tray available for important snacks.

Now, of course, I’ll do something that isn’t in Jira. Why? Because Jira is mostly where things never to be done go to languish, drinking cocktails and sunning on a beach somewhere, served by polite yet clever sand-resistant robots whose joy comes from service. Or, possibly, where things go to die. I prefer the happier story.

I have two pictures to compare. Here’s our game:

our game layout

And here’s the original:

original game layout

What seems to be the case is that the player turret is lower down on the screen, and so are the Shields. I will have to review the original source code to see if I can come up with the actual numbers, but by eye, I think we can see that things need to move down. I would say that there are two player turret heights of blank below the player turret, and one blank blow the shield and above the player.

The Player’s center is calculated like this: = Vector2(self.left, u.SCREEN_SIZE - 5*32 - 16)

In Photos, I find a picture where I drew a grid on the original game:

gridded original

Let’s see what we’ve got here. For now, let’s base everything on the bottom line, which is drawn:

        rect.bottomleft = (64, u.SCREEN_SIZE - 56)

Let’s get some more sizes. Our Player is nominally 8 pixels high, or 32 at our scale of 4. The Shield is twice that, or 64 pixels on my screen. The bottom line is 4 pixels high, equivalent to a single pixel line on the original.

Reserve Players are centered: = Vector2(x, u.SCREEN_SIZE - 32)

I think we want:

  • Reserves at 32
  • Bottom Line at 50
  • Player at 128
  • Shields at 208

realigned looking pretty good

That’ll do for now. But the numbers are all over the map. Let’s move them all to u.

BottomLineOffset = 50
InvaderPlayerOffset = 128
ReservePlayerOffset = 32
ShieldOffset = 208

Now they’re all in u and can be edited as a unit.


Just a tiny tweak, a step in a good direction, and we even removed a few magic numbers, making them a bit more meaningful and consolidating them into one file. Not exactly profound progress, but a noticeable improvement. (Wasn’t there an add that said that? I can’t find it in the goog. Anyway, the game is a bit more like the original.)

I will not be adding this to the Jira and then crossing it out. The file isn’t there to track my progress, it’s there to serve as a reminder of what I want to do. I might scratch things off sometimes, just for a feeling of accomplishment, or to communicate progress with you, my customer. Or, then again, I might not.

See you next time!