Introduction
Play out this difficult game of survival as the key member of a Royal Navy helicopter squadron under missile attack
The task force, headed by its aircraft carrier flagship, awaits the return of its helicopter squadron. The squadron is being attacked by missiles.
A sole fighter helicopter, armed with two cannon, is available to defend the incoming squadrom and the vulnerable carrier. You have the controls.
The game can be played with either keys or joystick (Use the left joystick with the firing button pointing away from you).
I think the game is slightly easier with the keyboard option but remains very difficult to beat.
Main Program
Lines 60-110. These palette-changing commands enable objects on the screen to appear to move in front of, or behind, other objects when used with GCOL 3 (Exclusive OR) graphics colour command.
For example, I needed the white bullets to pass behind the green helicopters. White (colour seven) EORed with green (colour 2) produces magenta (colour 5) which does not work.
I therefore redefined colour 11 as white and colour 9 as green. Colour 11 EORed with colour 9 produces colour 2 (green). The effect will not work. Colour 11 (white) goes green when passing over the green helicopter and therefore appears to go "behind" it.
Main Variables
HELINUMBER% | Number of remaining helicopters |
MX%,MY% | Missile positions |
FX%,FY% | Bullet position |
FIRE% | Flag to indicate if bullet is travelling |
RANGE% | Distance bullet has travelled |
HIT% | Flag to say if bullet has made a hit |
DEATH | Flag indicating end of game |
SAFE% | Number of helicopters reaching safety |
LX%,LY% | Your helicopter's position |
oldLX%,oldLY% | Your helicopter's previous position |
CHOICE% | One for keyboard option, two for joystick |
Program Description
150 | Initial printing of squadron |
160-280 | This is the main loop which is exited if your helicopter or the carrier is destroyed (DEATH = TRUE) or you lose all the squadron (HELINUMBER% = 0) or you get all the remaining squadron to safety. You also exit this loop every ten seconds to reposition the squadron. |
PROCMOVE | Lines 330-340. FIRE% (1 or 2) will be TRUE if either bullet is already on its way. Line 350 points to the correct procedure for keyboard or joystick control. Line 360 creates the animation effect by printing helicopter in its new position and Exclusive ORing in its old position and thereby erasing it. |
PROCFIRE | Moves the bullet, calculates how far it has gone and whether it has hit anything. |
PROCJOY | Joystick control option. |
PROCKEY | Keyboard control. Notice how INKEY(-) will respond to dual pressing of keys giving diagonal movement. |
PROCSEA | Invisibly builds up the sea (colour six is changed to black and back to cyan when picture is complete) while the title is flashed up.
Line 860 prints the aircraft carrier. |
PROCMISSILE | Moves three missiles through a loop.
Line 960 changes trajectory of missile if it is over halfway across Lines 980-1010. Is the missile touching a colour which indicates a hit? POINT refers to the logical colour (i.e. the number of a colour regardless of whether its actual colour has been changed). Lines 1020-30. If a bullet is in progress, check if a missile is being hit by using PROCCHECK. Line 1040. Reposition missile in a new random starting position when it moves off screen. |
PROCHELS | Every 10 seconds this procedure reprints the squadron nearer to safety. Once a helicopter goes off screen, PROCSAFE is called to keep a track of the number of helicopters which are safe. |
PROCHELIHIT | Works out which helicopter has just been hit. |
PROCMISSILEHIT, PROCFLAGSHIPHIT, PROCCARRIERHIT | All delete targets when destroyed. |
PROCEXPLODE | Creates explosion. Parameters: C - colour of targets and therefore explosion; E%,G% - coordinates of target and explosion |
PROCWAIT | Delay loop. |
PROCMESSAGE | Prints various messages at bottom of screen. |
PROCINIT | Prints title and instructions and gives options for control. |
PROCCHR | Initialises variables. Sets initial random positions of missiles and helicopters. Defines the character set. |
PROCCHECK | Has a bullet hit a missile? |
PROCZAP | Firing sound for cannon. |
PROCSAFE | Number of helicopters safe. |
PROCWIN | This is only entered when all remaining helicopters are safe and you and the carrier have survived. It is pretty difficult to get this far. Perhaps you could make the messages a little more sympathetic and encouraging. Personally, I've got a mean streak. |
Tip
To make life easier, you can also change the figure after UNTIL TIME = in line 170. Reducing this means that you don't have to survive for so long.