6 Shooter

See all articles from SYNC v2 n2

6 Shooter is a game of skill in which you attempt to hit a randomly moving target. When the target appears in a position which you feel is in your sights, you pull the trigger (hit a key). This causes a bullet to be fired, and, if the target is hit, it disintegrates in accordance with the accuracy of the shot. The number of shots fired and hits scored are displayed at the bottom of the screen. After six shots you must reload to continue playing. Before the commencement of play, you are asked to select the level of difficulty you desire. As your skill increases, you may increase the level of difficulty and continue to find the game challenging. Indeed, at skill factor 0, success requires lightning fast reflexes. Because play occurs in real time, through the use of the INKEY$ function, I find a level of excitement often absent in other ZX81 games.

Drawing of a gunslinger
Drawing of a gunslinger

Many of the techniques used in 6 Shooter may be adapted for use in your programs. 6 Shooter has been optimized for speed by placing often used subroutines at the beginning; the operating system searches for called subroutines beginning at the first program line. The subroutine which produces the title in characters four times their normal size is easily alterable to display any message by changing the contents of T$.

The algorithm which moves the bullet across the screen is conveniently short, and the apparent speed may be controlled by changing step value.

Another useful subroutine is found at RICOCHET. Virtually any pattern of movement may be created by the use of this routine.

A Basic DATA statement is created by allowing R$ to hold the coordinates to be PLOTed and READing them out with the FOR, NEXT loop. By the use of PRINT AT statements, selected areas of the screen may be written over for updating or erased by over printing with spaces, as in the CLS and score subroutines.

With 16K of user programmable memory available, there is no reason why a creative individual could not expand this program to include such features as: automatically increasing the difficulty with each reload, score keeping for two players, different types of targets with different point values, linear vertical movement of the target. Another nice feature would be to ask the player who has beaten the previous high score to enter his name as the new champ.

Good luck and good shootin’.

Sample Run: the "6 SHOOTER" title in large letters, the gun at left, the target at right, and HITS=3 SHOTS=5 at the bottom
Sample Run: the "6 SHOOTER" title in large letters, the gun at left, the target at right, and HITS=3 SHOTS=5 at the bottom

Listing

Note: [inv …] marks inverse-video characters; [graphics] marks graphic characters in the original that cannot be reliably transcribed.

  10 REM **[inv 6 SHOOTER]**
20 REM COPYRIGHT 1982 [inv REV.]1.0
30 REM DIGHERA
40 FAST
44 GOTO 1300
50 REM [inv CLS]
51 GOSUB 1150
52 PRINT AT TRG-1,30;" "
53 PRINT AT TRG+1,30;" "
55 PRINT AT TRG,31;" "
57 PRINT AT 13,31;" "
59 RETURN
60 REM [inv TARGET GENERATER]
80 PRINT AT TRG,31;" "
90 LET MISS=0
100 LET TRG=INT (RND*17)+4
110 PRINT AT TRG,31;"▒"
120 RETURN
130 REM [inv SKILL]
140 IF INKEY$<>"" THEN RETURN
150 FOR W=1 TO SKL
160 IF INKEY$<>"" THEN RETURN
170 NEXT W
180 LET MISS=1
190 RETURN
200 REM [inv SCREEN]
220 LET X1=0
230 LET T$="6 SHOOTER"
240 PRINT AT 3,0;"[graphics: a row of dotted graphic characters]"
250 FOR I=1 TO LEN T$
260 LET J=CODE T$
270 LET T$=T$(2 TO LEN T$)
280 FOR Y=0 TO 7
290 LET K=PEEK (7680+J*8+Y)
300 LET L=128
310 FOR X=0 TO 7
320 IF K<L THEN GOTO 350
330 PLOT X+X1,43-Y
340 LET K=K-L
350 LET L=L/2
360 NEXT X
370 NEXT Y
380 LET X1=X1+7
390 NEXT I
400 PRINT AT 21,0;"[inv HITS=]";"0 ";
410 PRINT "[inv SHOTS=]0"
420 PRINT AT 13,0;"[graphics]"
430 PRINT AT 14,0;"[graphics]"
440 RETURN
450 REM [inv SKILL SELECT]
460 GOSUB 1130
470 PRINT AT 9,5;"SELECT SKILL FACTER"
480 PRINT AT 10,5;"(0=DIFFICULT, 10=EASY)"
490 INPUT SKL
500 PRINT AT 8,0
510 FOR I=1 TO 64
520 PRINT " ";
530 NEXT I
550 RETURN
850 REM ****[inv TURN]****
860 IF SHTS>0 THEN GOSUB 50
870 LET TRG=21
880 PRINT AT 13,0;"[graphics]"
890 GOSUB 70
900 IF INKEY$<>"" THEN GOTO 960
910 IF TRG<>21 AND MISS<>1 THEN GOSUB 130
920 IF MISS=1 THEN GOSUB 70
940 IF INKEY$="" THEN GOTO 900
960 REM [inv BULLET]
970 FOR X=0 TO 63 STEP 9
980 IF X>0 THEN UNPLOT X-9,17
990 PLOT X,17
1000 NEXT X
1010 LET SHTS=SHTS+1
1030 IF TRG<12 OR TRG>14 THEN RETURN
1050 REM [inv EXPLO]
1060 PRINT AT TRG,31;"[graphics]"
1070 PRINT AT TRG-1,30;"[graphics]"
1080 PRINT AT TRG+1,30;"[graphics]"
1084 IF TRG=13 THEN GOTO 1100
1085[graphics]REM [inv RICOCHET]
1086 LET R$="5819572155225322542155235425522750284828492750294931"
1087 REM LET R$="6019592157225522562157235625542752285028512752295131"
1088 FOR I=1 TO 13*4 STEP 4
1090 IF I>1 THEN UNPLOT VAL R$(I-4 TO I+1-4),VAL R$(I+2-4 TO I+3-4)
1091 PLOT VAL R$(I TO I+1),VAL R$(I+2 TO I+3)
1092 NEXT I
1096 UNPLOT VAL R$(I-4 TO I+1-4),VAL R$(I+2-4 TO I+3-4)
1100 LET HITS=HITS+1
1110 RETURN
1130 REM [inv SCORE]
1150 PRINT AT 21,5;HITS
1160 PRINT AT 21,15;SHTS
1180 RETURN
1300 REM ****[inv UTILITY]****
1330 GOSUB 200
1340 LET SHTS=0
1350 LET HITS=0
1360 GOSUB 460
1370 SLOW
1380 GOSUB 850
1400 GOSUB 1130
1420 IF SHTS<6 THEN GOTO 1380
1430 GOSUB 50
1440 REM [inv RELOAD]
1450 PRINT AT 9,5;"HIT[inv L TO RELOAD]"
1460 PRINT AT 9,5;"[inv HIT]"
1470 PRINT AT 9,5;"HIT"
1480 IF INKEY$="" THEN GOTO 1460
1490 IF INKEY$="L" THEN GOTO 1340
1500 IF HITS=0 THEN PRINT AT 9,5;"YOU NEED PRACTICE"
1590 IF SHTS/HITS<=2 THEN PRINT AT 9,5;"** [inv GOOD SHOOTIN] **"
1600 IF SHTS/HITS<=2 THEN PRINT AT 9,5;"** GOOD SHOOTIN **"
1610 GOTO 1590
1900 STOP
2000 SAVE "6 SHOOTER"
2010 PRINT "[inv LOAD COMPLETE]"
2020 PAUSE 200
2024 CLS
2030 RUN

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.