NAVARONE ABLAZE! ---------------- by Ken North from ZX Computing, October/November 1982 A few user-defined graphics here, a blob of colour there, a BEEP or two tc keep the neighbours bemused, and Ken North Of Ashford, creates this program to keep trigger fingers twitching. This program shows an aircraft flying from right to left above an anti-aircraft battery. The A.A. guns are firing at the aircraft, and the aircraft can drop bombs to destroy the guns. You drop a bomb by pressing the 'M' key. The A.A. fire reduces when you knock out a gun, but beware, the gunners are very accurate and have found your exact height, so you must knock a gun out very quickly to survive a round. The main program runs from line 10 to 299, and the REMs explain what the other routines do. The first section, lines 10 to 100, sets up the screen. Line 10 calls the routine to set up the user-defined graphics. The DATA for these were converted to decimal numbers, and then stored in lines 1100 to 1120. These are then read and POKEd into the appropriate character. The aircraft uses the graphic characters "A", "B" and "C". The bomb is "D" and the gun is "E". Lines 20 and 30 set the screen colours to a white sky, green ground and a black border. The CLS command, after changing PAPER colour is, as you probably know, important. If you don't CLS, the old paper colour remains, and only changes when you print something, which can give you some strange and colourful (although unwanted) effects. Lines 40 and 60 set up the variables. Lines 70 to 90 find the gun positions, line 85 checks for three different positions, and line 100 prints the guns. The "E" is a graphics "E" which will change to the gun after the first call to subroutine 1000. Lines 110 to 200 are the loop for the aircraft printed in line 120. The "A", "B" and "C" are the graphics and, in line 100, the trailing space is to clear the last character as the aircraft moves across the screen. Line 140 checks for key "M" and sets a flag F1. If set, the program jumps to the "bomb drop routine". If clear, a PAUSE is put in so that the program runs at the same speed as it does when a bomb is dropped. The A.A. fire is controlled by line 170. The values can be changed to make the game easier or harder, but the 1.8 seemed a good compromise. Line 180 again puts in a PAUSE to keep the routine the same, whether the guns fire or not. The variable HITS in line 190 checks to see if all three guns have been destroyed, and if it finds that they have, increments the score, and then branches to clear the ground and print a new battery. The rest of the main program prints your score after you have lost all your aircraft. The BOMB DROP routine prints the bomb if F1 is set. If the bomb hits the ground, F1 is reset for the next key-push. The check, to see if you have hit a gun, uses the ATTR function in line 340. The ATTRibute call returns a value — in binary — which depends on certain conditions. The MSB (bit 7) is for FLASH, bit 6 is for BRIGHT, bits 5 to 3 for PAPER colour and bits 2 to 0 for INK colour. In case of the gun, it is not flashing, and is normal brightness, so bits 7 and 6 are at zero. The PAPER is white, so bits 5 to 3 are all ones and the INK is red, so bit 1 is 1 and bits 2 and 0 are zero. This gives a BIN 00111010 which, when converted to decimal, gives 58. If the program returns 58 at line 340, it branches to 400, the SCORE and BANG routine. This causes the guns to explode ... and increments the score. The A.A. routine called by line 170 puts a flash on the screen, and checks if it coincides with the nose of the aircraft. If it does, it calls the SHOOTDOWN routine at line 600. SHOOTDOWN makes the aircraft crash, flashing as it does so. The flash is confined to the plane, as it is locally defined in the PRINT statement, and therefore ends with the statement. A PAUSE follows, to allow you to get your breath back, before the action starts again. You get six aircraft to try and destroy as many guns as you can. If you want to make changes in colour, or to the A.A. fire, the only line you have to be careful of is 340 with the ATTR function call. If you change the sky colour (PAPER), or the gun colour (INK), you will have to work out the corresponding ATTRibute, referring to page 116 of the manual. Another thing to watch is whether the keyboard is in the C or L mode for the bomb-drop. I've made the program run for the C mode, but line 140 could be changed to read both by changing it to: 140 IF INKEY$="M" OR INKEY$="m" THEN LET F1=1