CLOSE ENCOUNTERS OF THE FOURTH KIND


The aliens have sneaked into this book after all - but we believe they are friendly. It's up to you to find out.

Hovering above a field, lights rotating around it's outer edge, is a flying saucer. From the saucer comes a sequence of notes which may contain a message of peace. To find out you must repeat the notes in the same sequences as the aliens have transmitted them.

Every time you repeat the notes properly, the saucer will descend one level towards the ground. Try and bring them in carefully as the last time we succeeded the space vessel blew up after landing.

How to play

The number keys 0 to 9 represent a note in the octave starting with middle C.

Key in S to indicate the start of a tune.

You can either try guessing by starting with S or you can play with the keyboard until you have found the correct note.

The saucer will first emit one note and, if you copy correctly, descend slightly before sounding its next tone which will be a tune of two notes and so on. Each time you have guessed the sequence correctly the saucer will descend. Remember to start each guess with S.

If you can't find the correct note press G and RETURN and a new tune sequence will begin.

Programming hints

The sound buffer is flushed just before you key in a tune when S is pressed by using *X15,0 in line 780. This is to prevent the last few notes the player has just keyed in from being played before the tune he is about to key in. Commands commencing with an asterisk may not be including in a line of more than one statement. I have got around this by putting *FX15,0 in a procedure and calling the procedure.

You could increase the number of possible notes in the tunes by changing the maximum value of N(L) in line 220. Then add lines for larger values of NT after line 750.


   10 REM CLOSE ENCOUNTERS OF THE FOURTH
 KIND
   20 REM COPYRIGHT (C) G.LUDINSKI 1983
   30 MODE 5
   40 DIM N(7)
   50 CLS
   60 REM
   70 REM DRAW SPACE SHIP
   80 REM
   90 VDU 19,2,2,0,0,0
  100 HT=964
  110 PROC_SHIP(HT,3)
  120 GCOL0,2
  130 MOVE0,0
  140 FORX=0 TO 1280 STEP 10
  150   DRAWX,RND(100)
  160 NEXTX
  170 REM
  180 REM GENERATE NOTES
  190 REM
  200 FORJ=1TO7
  210   FORL=1TOJ
  220     N(L)=INT(8*RND(1)+1)
  230     IF L=1 THEN 250
  240     IF N(L)=N(L-1) THEN 220
  250     PROC_PLAY(N(L))
  260   NEXTL
  270   REM
  280   REM PLAY NOTES
  290   REM
  300   EI=0
  310   I=140
  320   FORK=1TOJ
  330   I$=INKEY$(0):IF I$<>"G" AND I$<>
"S" AND (I$="" OR I$<"1" OR I$>"9") THEN
 I=I+50:PROC_LIGHTS(HT):GOTO330
  340 IF I$="G" THEN K=J:GOTO380
  350 IF I$="S" THEN PROC_FLUSH:K=1:GOTO
330
  360 PROC_PLAY(VAL(I$))
  370 IF VAL(I$)<>N(K) THEN EI=1
  380 NEXT K
  390 IF I$="G" THEN GOTO 210
  400 IF EI=0 THEN PROC_SHIP(HT,0):HT=HT
-120:PROC_SHIP(HT,3):PROC_ROTATE:GOTO420
  410 GOTO300
  420 NEXTJ
  430 REM
  440 REM EXPLOSION
  450 REM
  460 FORI=1TO100:VDU19,0,1,0,0,0,19,0,3
,0,0,0:NEXT I:GOTO 840
  470 :
  480 DEFPROC_SHIP(HT,CL)
  490 GCOL 0,CL
  500 PROC_BLOCK(140,HT-20,1000,40)
  510 MOVE460,HT
  520 MOVE500,HT-60:PLOT85,500,HT+60
  530 MOVE 820,HT
  540 MOVE780,HT-60:PLOT85,780,HT+60
  550 PROC_BLOCK(500,HT-60,280,120)
  560 ENDPROC
  570 DEFPROC_BLOCK(X,Y,W,H)
  580 MOVEX,Y:MOVEX+W,Y
  590 PLOT85,X,Y+H
  600 PLOT85,X+W,Y+H
  610 ENDPROC
  620 DEFPROC_LIGHTS(HT)
  630 IF I>=1090 THEN GCOL0,3:PROC_BLOCK
(I,HT-20,50,40):I=140
  640 GCOL0,3:PROC_BLOCK(I,HT-20,50,40)
  650 GCOL0,1:PROC_BLOCK(I+50,HT-20,50,4
0)
  660 ENDPROC
  670 DEFPROC_PLAY(NT)
  680 IF NT=1 THEN SOUND 1,-15,53,10
  690 IF NT=2 THEN SOUND 1,-15,61,10
  700 IF NT=3 THEN SOUND 1,-15,69,10
  710 IF NT=4 THEN SOUND 1,-15,73,10
  720 IF NT=5 THEN SOUND 1,-15,81,10
  730 IF NT=6 THEN SOUND 1,-15,89,10
  740 IF NT=7 THEN SOUND 1,-15,97,10
  750 IF NT=8 THEN SOUND 1,-15,101,10
  760 ENDPROC
  770 DEFPROC_ROTATE
  780 *FX15 0
  790 FORD=1TO50:I=I+50:PROC_LIGHTS(HT):
NEXTD
  800 ENDPROC
  810 DEFPROC_FLUSH
  820 *FX15 0
  830 ENDPROC
  840 REM