Tuesday, March 29, 2005

Aliens can't fly straight

So now there are hordes of aliens raining from the top of the screen. You can shoot 'em, but that is about all that happens.

Shooting them does give some energy back, and the game keeps score too. So that is all good. I got that all going about a week ago, but got stuck on the flight patterns of the first aliens.

Most shooters seem to get the aliens looping and circling down the screen, so I thought I'd have a look at that too. It took me a while to figure out how to draw a circle, but I found a simple algorithm on the web using cos and tan.

It took me ages to get an alien going in a smooth circle, but I finally got it going. Now I have to find some way to get the aliens to randomise the patterns a bit, and to change direction so sometimes they drift left, sometimes right, sometimes looping right around or something.

I am sure there is a simple algorithm using percentages for each possible type of action that will result in a good alien flight pattern, but it hasn't occured to me yet. It must be simple as all those old arcade games didn't have a lot of space or time to do this stuff in!

I have noticed that having two guns going (one under each "wing") is very inefficient of the ship's energy. Most of the time one of the two shots travels uselessly off the top of the screen, not hitting anything but taking your energy with it. I need to think about it - there is no point having all these weapons if they do more harm to you than the alien hordes.

0 Comments:

Post a Comment

<< Home