Tutorial: How to write games part 2

Go to page << 1 2 3 4 5 6 7 8 9 10 11 >>

Game complete ("completer"? :-)

So now we have something that looks a bit more like a complete playable game.
There are still a lot of things we could do to improve it, such as automatically ending the game once all the aliens are shot (or moving onto the next level..?). Or letting the player shoot more than one bullet at a time. I'll leave these up to you.

Too hard? (Or too easy?)

You may also have noticed that the game is quite difficult at the start. This is no big deal, it just means we need to fine-tune some of the parameters. I'll leave this up to you also, but here are some ideas:

Lower the frequency that the aliens shoot

For example, changing the line that reads:

if rnd () % 10 + 1 = 1 then


if rnd () % 30 + 1 = 1 then

Will give the aliens a 1 in 30 chance of shooting each time instead of 1 in 10.
(Or try some other numbers.)

Change how high the aliens fly overhead

Replace this line:

alieny(i) = rnd () % 22 + 1


alieny(i) = rnd () % 20 + 1

To stop the aliens coming in quite so low.
(There are two places in the program with this line, you'll need to replace both.)

Adjust the number of aliens and bombs

Change the 10 in line:

const alienCount = 10

To the number of aliens you want to have on the screen.

Change the 10 in line:

const bombCount = 10

To the number of bombs you want on the screen.

Speed-up/slow-down the game

By changing the line:

Sleep (75)

To a different number. (Higher numbers slow the game down. Lower numbers speed it up.)

Adjust the number of lives

By changing the line:

lives = 3


And that about wraps it up for this tutorial!

Go to page << 1 2 3 4 5 6 7 8 9 10 11 >>