The following article was printed in January 1993 of the magazine „8000 PLUS"
A game programmed in BASIC

FOLLOW ME by Norman Barrington, Peterhead

FOLLOW ME is the kind of basic game that becomes addictive, not just because of its playability and superior use of sound, but because it does so much with so few lines of code.
The challenge the PCW sets you is to follow the square which appears on the grid. But get it wrong and it's back to the beginning!
As its name suggests, this is a game in which you have to copy what the computer does. The screen is divided up into a grid in which a green square appears in one of four positions (or a white square, depending on the type of PCW you have). This square remains on screen for a brief moment and then disappears. Now you must press the cursor key that relates to the position the block was in (the left/right key if a box is displayed on the left/right and the down key for a box at the bottom).
If you get it wrong, your mistake is announced by a noise your PCW doesn't usually make and the game starts again. If you get it right, the first square reappears followed by a second. You have to repeat this sequence using the cursor keys.
This pattern will continue to repeat and increase until the time finally comes when you simply can't remember any more and make a mistake. The more you get right, the faster the sequence becomes! At the end of each game you can compare your last score to your highest so far.
An important feature of the game's design is sound. Each position on the grid and the cursor key relating to it gives a note when activated. There is even a short tune at the start of each game. If you are feeling creative and want to change the notes you can do so by altering some of the values defined in the program.
Look at line 230 for example. This line is used when you get the sequence wrong. The line starts with the statement 'x=9:d=1'; this statement defines the note that is played. 'x' is the pitch (or sound) and can be within the range of 0-9, giving you the choice of 10 different notes; 'd' is the duration, or length of time the sound will last. Experimenting with these soon shows that the PCW is capable of producing far more interesting sounds than those you hear if you press the wrong key in LocoScript!
The listing defines 10 notes using the 'FOR n=0 to 9' statement in line 340 and the last 10 items in line 400's DATA statement. The FOR statement can be altered and extra data can easily be added to give you a further selection of notes, but be careful, if you change the wrong DATA statements, the program could seize up. Because of this, you have to be very careful when typing these lines in. As ever, it is important to save the program before you run it for the first time.
On the subject of DATA statements, over the last few months a number of people have written to us saying that some of the programs they have typed in aren't working. The most common reason for this is a mistake in one of the DATA statements. This is because these statements are often very long and contain a large amount of information. If just one of the numbers is entered incorrectly, a whole list of problems can be caused.
Amongst the letters that came in on the subject, one of them provided a solution to the problem. You can find it in this month's Tipoffs on page 58.
This method can also be used to avoid getting errors when typing in the function statements in lines 90 to 130 of this month's program.

This section sets up the screen display ready for the game to start. There is no quit option, but any key other than a Cursor key will stop the game
Lines 140 to 180 generate a random sequence so that no two games will be the same, lines 190 to 250 accept your input (the cursor keys you press)
Lines 260 to 280 print the block in the correct grid square, sounds the right note and then erases the block from the grid
This section of the program defines the graphics and the sound used in the program. The last ten items in line 400's DATA statement are the ones that can be changed for different sounds
[BASIC listing and assembler listing]

Scanned by Werner Cirsovius
December 2004
© 8000 PLUS