2007-07-21

Canvas Invaders

One of the first games I tried to program in AMOS, about 14 years ago, was Space Invaders. Despite it being one of the simplest games to write it completely eluded me at the time - I think I managed to get a single invader moving its way down the screen, but the player’s ship, the other invaders and, most of all, the bullets, were completely beyond my abilities.

Coding in Javascript for the canvas element is so simple and so enjoyable that I decided to have a go at writing something other than Pong, and as I still hadn’t written a version of Space Invaders it seemed like a good choice.

So, here’s another hastily-written canvas element game, coded in a couple of hours today between playing Scrabble in Facebook and reading the latest Harry Potter:

Canvas Invaders

Use the cursor keys to move left and right and the space bar to fire. You have three lives, but the game doesn’t warn you when you lose them, nor does it tell you how many you have left. There is no scoring system and the invaders don’t get faster as you kill them off or progress through the levels (the game doesn’t really include the concept of levels; it’s just the same wave over and over again). If the invaders reach the same vertical position as your ship it’s game over.

Also, all of the graphics are black squares. That’s what you get in a couple of hours, I’m afraid.