Air Attack

24K Cassette or 32K Disk
by Scott Sheck

When the game begins the sky will be clear, but then a loud siren will sound, warning you of an Air Attack. You will begin to see missiles heading toward your central missile base and six missile factories. The only defense will be to fire your own high-speed missiles to intercept the oncoming ones. You are equipped with 30 missiles; however, if the enemy should bomb your missile base, you will be left defenseless.

Occasionally, an enemy craft will pass over your factories, dropping containers of explosive fuel. Should one of the containers hit a factory, it will explode. On the other hand, if the container hits the ground, the explosive fuel will spill out. It will be hazardous only if ignited by one of the enemy's missiles.

Periodically, enemy attacks will be suspended while you are replenished with missiles. The assault will start up again, but with much faster missiles than before, and enemy crafts which travel faster, with increased resistance to your interceptor missiles. The game ends when all of your missile factories have been destroyed.


Scoring will be as follows: enemy missiles -- 5 points; enemy craft -- 25 points; and fuel container -- 50 points. Additional points: after each attack ceases, you will receive 100 points for each missile factory that has remained standing and 5 points for each of your unused missiles. Bonus: every 2000 points, you will receive an extra missile factory.

Designing the game

If you've never programmed a game, you might ask, "Where do you start in programming a game?" To answer this question, let's take a look at this game.

Step 1 -- I first started by drawing the scenery (the non-moving objects). This included the missile base, the six missile factories, the ground, the interceptor missiles and the score. Printing the score (Line 25) involved modifying the display list, which description for the sake of brevity I have omitted here. The rest of the scenery was drawn by Lines 400-445 in graphics mode 7.

Step 2 -- Next, I figured out what the moving objects were going to look like. Moving objects included the enemy missiles, the enemy craft, the fuel container and the aim. Before placing these objects on the screen, I had to find a way to make them all move at the same time. If you played the game and watched the objects move, it probably looked as if they were, indeed, all moving at the same time. Actually, they were not. Each object was taking turns moving.

To show how I did this, let's take as an example three objects labeled 1-3. To make it look as if all three objects are moving at the same time, I would do the following: a. move object 1; b. move object 2; c. move object 3; and d. go back to "a." Your computer could go through these steps so quickly that it would appear as if all three objects were moving simultaneously. To convince yourself of this RUN the short program below on your computer.

20 A=l:B=l:C=1:REM starting point for
each object
30 PLOT 40,A:A=A+1:REM move object 1
40 PLOT 60,B:B=B+1:REM move object 2
50 PLOT 80,C:C=C+1:REM move object 3
60 GOTO 30

Now, suppose you wanted object 1 to move faster than the other lines. You would do this by adding the line below to the program:

25 PLOT 40,A:A=A+l

Step 3 -- The next step I took was to detect collisions between the moving objects. I did this by using the two BASIC commands: COLOR and LOCATE. This is how I used the color registers: color 0 -- sky (background); color 1 -- ground; color 2 -- enemy missiles; and color 3 -- explosions, missile factories, missile base.

This is how I detected collisions (using the LOCATE command): enemy missile -- if it touches color 3 then erase missile trail and place explosion there (Lines 120-130), if it touches color 1 then erase missile trail (Line 130); fuel container -- if it touches color 1 then draw spilled fuel (Line 160), if it touches color 3 then erase container and place explosion there (Line 165); and enemy craft -- if it touches color 3 then erase craft and place explosion there (Line 160).

[Air Attack screenshot]
Air Attack

These are the steps I took when moving the objects in my game (Lines 50-96):

Setting up the game

Type in the program and then SAVE it immediately before running the program. Only after you have saved the program, type RUN. The screen will then go blank for about fifteen seconds before the game begins.

This game requires an Atari with 24K of memory, however, you can play the game on a 16K Atari, if the title screen is removed. This is done by deleting the GOSUB 900 in Line 1011 and deleting Lines 899-995.

Final words

What inspired me the most in writing this game was Tom Hudson's article, "Graphic Violence" (ANALOG issue 8). After seeing the demo that was included in the article, I was so impressed that I had to come up with a game using the explosions, so I used his routine in this game. I later wanted to include player/missile graphics in my game, and I found two very easy-to-use player (ANALOG issue 10) and missile (ANALOG issue 11) routines that Mr. Hudson had also written. Unfortunately, I couldn't use these routines due to the large size of my program. However, I would like to thank Mr. Hudson for showing me how to add the player routine to the G.V. routine.

In addition to player/missile graphics, I also have added two machine language routines which help speed up the game's action. These routines were written by D.K. Titchenell. One routine, which is stored in POK$ in my program, allows my program to make multiple POKES. The other, stored in MOV$, allows fast movement of blocks of RAM to other areas of RAM.

Program description

Program variables

Archiver's Note: I believe Line 960 contains a typo. One of its statements reads FOR Y=O TO 3. It should probably read FOR Y=0 TO 3 (zero instead of the letter "O"). Of course, the program runs slightly faster by using a variable instead of a constant. If you want to keep the speedup -- assuming you would even notice its absence -- use a predefined variable and make the statement read FOR Y=CZ TO 3. (See Line 1005.)

AIRATAK.LST is available in ATASCII format.

This BASIC listing uses an image to display special characters

Checksum Data
1 DATA 141,580,472,292,546,689,712,346
80 DATA 959,51,404,381,239,639,485,968
165 DATA 975,583,894,911,618,894,897,7
313 DATA 713,902,895,892,723,906,887,4
434 DATA 859,77,16,760,692,604,898,18,
860 DATA 349,429,178,702,548,530,780,8
952 DATA 697,325,764,529,892,863,846,9
2855 DATA 469,98,800,988,813,735,5,392
3503 DATA 453,449,455,473,485,732,731,
4201 DATA 802,894,735,321,122,917,862,
12000 DATA 964,263,34,432,51,377,13,7,
15100 DATA 958,239,326,614,853,887,899
17000 DATA 525,454,933,930,561,3403

Previous | Contents | Next

Original text copyright 1984 by ANALOG Computing. Reprinted with permission by the Digital ANALOG Archive.