HOME BASE

by David Naylor

from ZX Computing Feb/Mar.1984



[HOMEBASE.TAP includes the correction from the author printed]

[in the Apr/May issue (p.9)                              JimG]



Get back home as soon as you can in this program

for the Spectrum, courtesy of David Naylor of Leeds.





The object of this game is to move your spacecraft from the

bottom left-hand corner of the screen to the top of the

screen, your home base. However, there are two problems you

will encounter. Firstly, the gateway through which you can

escape to your home base is getting smaller as you progress

up the screen. And also there are a number of obstacles

which get in your way.





On the level



Once the program has been entered and RUN, you are given

scoring and skill level instructions, and which keys you use

to move. If you do not press a key, your spacecraft will

always move forward, and you score points for moving

forwards, left and right. There are certain objects

scattered around the screen, such as shooting stars, power

packs and flying saucers, for which you will gain extra

points if you collect them. You can also gain extra lives

should you collect these objects but you can only achieve a

total of nine lives.



There are seven skill levels; the level of the game is

displayed at the top of the screen along with the score, the

high score, the amount of time you have left and the number

of lives you have left. The skill level is related to the

number of obstacles you have in your path and the time you

have left to get through the gateway at the top of the

screen before it completely closes.



The gateway to your home base will close, bit by bit, until

it completely closes thus trapping you in the playing area.

The rate at which this happens is related to the main

playing loop - so, the longer you stay in the playing area

collecting more points, the more difficult it is to get back

to your home base.



One special feature included in this program is the one for

choosing the skill level you wish to start on. You can

either choose the level you start on and specify a new level

when you have completed your mission. Or you can choose to

start at level one and progress through the subsequent

levels (assuming you manage to do that!) automatically.



One little problem I ran into when writing this program was

that I had related the closing of the gateway at the top of

the screen to the number of points you have. Thus, in some

of my earlier versions of the game, when you went onto a

second level having completed the first, the computer looked

at the score you had amassed and shut the gateway instantly

not giving you a chance at all. Therefore, I included the

variable, SCS, which holds your score from previous rounds

and is added onto the score you gain from each level. Thus,

while you play each level your score is reset to zero so

that the gateway to your home base does not close before you

move.





Variables



HI      The high score.

SCS     The scores.

SC      The score from each individual level.

L       The number of lives you have.

DI      The level of difficulty you have chosen.

I$      The type of difficulty set on that level.

S and K Random numbers used for the initial plotting.

W       The main loop and time allowed.

X       The random number used in the closing of the gateway.

C and R These are used for plotting the spacecraft movement.

Z and X These are used for plotting the obstacles in the main program loop.

N       Used (in graphics mode) for the spacecraft's user-defined graphics.





Line by line



Line 5          Fixes the user-defined graphics.

Lines 45-80     Provide the instructions and inputs.

Line 90         Fixes the number of lives you have.

Lines 115-158   Deal with the initial plotting of the obstacles.

Lines 160       Sets up the initial position of the spacecraft.

Lines 170-190   Print the special objects to be collected at random positions.

Line 210        Prints the destination of your spacecraft.

Lines 295-500   Contain the main loop of the program. The length of the main

                loop is determined by the skill level and this then counts

                as the time allowed to complete the level (variable W).

Line 303        Prints the new position of the spacecraft.

Lines 323-345   Close the gateway to the home base with random number X.

Lines 349-365   Control the movement of the spacecraft.

Lines 369-376   Scan the position of the spacecraft to see what's there.

                Touching the home base barrier destroys you immediately.

Line 379        The computer already knows if you have touched the home base

                barrier and has dealt with it. Therefore, this line sends

                you to line 2000 if you have reached the top of the screen.

Lines 380-392   Choose the random numbers (X and Z) and plot an obstacle at

                the points, X and Z. They also make sure nothing is printed

                over the various displays at the top of the screen.

Lines 1000-1005 If you run out of lives and crash, this prints a final

                message accompanied by a series of BEEPs.

Lines 1010-1030 Ask you if you want to play again and check to see if the

                high score facility needs altering to a higher number.

Lines 1100-1115 Tell you if you have run out of time and then goes to

                line 1010 to see if you want to play again.

Lines 2000-2060 Tell you when you win, print the 'SCS' score, check what

                type of game you are playing and direct the program to

                line 80 or 90. If you are progressing from level to level

                up to level seven, you will receive a special message.

Lines 3000-3020 Tell you when your score gets too high and the home base

                disappears. The program is then directed to line 1010 to

                see if you would like another game.

Lines 5040-6000 Set the user-defined graphics.

Lines 7000-7400 Provide instructions on scores and lives from lines 369-376.





Points to note



After entering the program, you can save the program using

the following:



SAVE "HOME BASE" LINE 5



If you touch a key during the initial setting up of the

obstacles, when the plotting is finished the 'PAUSE 0' in

line 240 will not operate and the game will begin

immediately.



Finally, don't get too worried if on the higher levels you

are boxed in by obstacles as soon as you start as you should

have enough lives in hand to be able to cross a few

obstacles; you only lose one life each time you go over an

obstacle. Be sure to plan your route through the obstacles

before you start the game though.





--

Another Fine Product transcribed by:

Jim Grimwood (jimg@globalnet.co.uk), Weardale, England

--

