Sting Rayer

Type
Game
Category
Target-shooting arcade game
Author
Steve Argyle
Published in
Antic, June 1987 (Vol. 6, No. 2), Bonus Game
Year
1987
Language
Atari BASIC
Requirements
Any Atari 8-bit, any memory size, Atari BASIC, joystick in port 1
A blue text screen with the STING RAYER status line, a small TIE-fighter shape made of control characters, and a club-shaped target below it

About the program

Sting Rayer was the June 1987 Bonus Game, and its author was nine years old. Steve Argyle was the son of Bruce Argyle, who made Mad Scientist Software's Cardiac Arrest! simulator. Antic said its technical staff had condensed the program even further. What's left is a complete little arcade game in about 65 lines. You fly a TIE fighter, built from three control-graphics characters, around the top half of a text screen and drop shots on a target that drifts around near the bottom. You have 30 shots, and each hit scores at least 100 points.

Typing it in

The listing is short, but it has a few control characters, which are the ship and its bullet:

  • Line 60, {CTRL-J}{CTRL-N}{CTRL-H}: hold CTRL and press J, N and H inside the quotes. These are the TIE fighter's wing, body and wing.
  • Line 112, {CTRL-B}: the falling shot.
  • Line 150, {CTRL-P}: the target.
  • Line 500: {inv}START{/inv} is typed with the Atari (inverse) key before and after.

Line 37 says SOUND O,… with the letter O, not zero. It works anyway, because the unused variable O is 0, so keep it as printed if you want an exact copy.

How to play

Move the fighter with the joystick (diagonals work) and press the button to fire straight down. To score a hit, the target must be exactly under the ship's centre when the shot reaches its row. A hit is worth 200 points, minus 5 for every move the target has made since the last hit, but never less than 100. So quick shooting pays. After a hit, the target freezes for a moment and then jumps to a new position. When the 30 shots are used up, press START to play again.

How it works

  • Joystick arithmetic. Lines 41–42 turn the STICK(0) value into movement with comparisons. In Atari BASIC, (D=7) is 1 when true and 0 when false, so X=X+(D=7)+(D=6)+(D=5)-(D=10)-(D=11)-(D=9) moves right for right, up-right and down-right, and left for the three left directions.
  • Self-erasing sprites. The ship and target are printed with a blank border round them (lines 49–70 and 140–158). Each time they move one cell, the blanks wipe out the old copy, so nothing needs to be erased separately.
  • Timing with the clock. Lines 120–125 and 205–220 zero location 20 (the low byte of the real-time clock, which counts up every video frame) and wait until it reaches 6 or 20. That gives the same delay on any machine.
  • Escaping a FOR loop. When the bullet hits (line 111), POP throws away the FOR loop's entry on BASIC's runtime stack before jumping to the hit routine. The RETURN at line 230 then returns cleanly from the bullet subroutine.

Variations to try

  • Give yourself more ammunition by changing SHOTS=30 in line 8.
  • Make the target harder to hit: let it move twice per turn by calling GOSUB 135 twice in line 75.
  • Keep a high score. RUN (line 520) clears every variable, so change it to GOTO 8, keep the best SCORE in a variable such as HI, and print it on the out-of-ammo screen.

Listing

4 REM STING RAYER
5 REM BY STEVE ARGYLE
6 REM (c) 1987, ANTIC PUBLISHING
7 GOSUB 400
8 SCORE=0:PNT=200:SHOTS=30
10 X=15:Y=12
20 GRAPHICS 0:POKE 752,1
30 POSITION 2,0:? "STING RAYER   shots=";SHOTS:POSITION 27,0:? "score=0"
35 REM IS TRIGGER PUSHED?
36 IF SHOTS=0 THEN 500
37 IF STRIG(0)=0 THEN FOR N=15 TO 25:SOUND O,N,10,10:NEXT N:GOSUB 100:SOUND 0,0,0,0
40 REM ADD TO X,Y IF JOYSTICK MOVED
41 D=STICK(0):X=X+(D=7)+(D=6)+(D=5)-(D=10)-(D=11)-(D=9)
42 Y=Y-(D=10)-(D=14)-(D=6)+(D=9)+(D=13)+(D=5)
43 REM STOP FROM RUNNING OFF SCREEN
44 IF X<1 THEN X=1
45 IF Y<2 THEN Y=2
46 IF Y>12 THEN Y=12
47 IF X>33 THEN X=33
48 REM DRAW TIE FIGHTER AT NEW PLACE
49 POSITION X,Y-1
50 ? "     "
55 POSITION X,Y
60 ? " {CTRL-J}{CTRL-N}{CTRL-H} "
65 POSITION X,Y+1
70 ? "     "
72 IF HIT>0 THEN HIT=HIT-1:GOTO 35
75 GOSUB 135
80 IF PNT>100 THEN PNT=PNT-5
85 GOTO 35
100 REM SUBROUTINE FOR BULLET
105 SHOTS=SHOTS-1:POSITION 22,0:? SHOTS;" "
110 FOR N=Y+1 TO 21:POSITION X+2,N:? " "
111 IF N=E+1 AND C=X THEN POP :GOTO 200
112 POSITION X+2,N+1:? "{CTRL-B}"
114 NEXT N
115 POSITION X+2,N:? "*"
120 SOUND 0,25,8,10:POKE 20,0
125 IF PEEK(20)<6 THEN 125
130 POSITION X+2,N:? " ":SOUND 0,0,0,0:RETURN
135 C=C+INT(RND(0)*3)-1:E=E+INT(RND(0)*3)-1
136 IF C<1 THEN C=1
137 IF C>35 THEN C=35
138 IF E>19 THEN E=19
139 IF E<14 THEN E=14
140 POSITION C,E
145 ? "    "
149 POSITION C,E+1
150 ? "  {CTRL-P} "
156 POSITION C,E+2
158 ? "    "
170 RETURN
200 REM HIT
205 SOUND 0,35,8,10:POKE 20,0
210 POSITION X+2,N:? "*"
215 POSITION X+2,N+2:? PNT;
218 GOSUB 400
220 IF PEEK(20)<20 THEN 220
222 SCORE=SCORE+PNT:POSITION 33,0:? SCORE:PNT=200
225 POSITION X+2,N:? " ":POSITION X+2,N+2:? "   ";
230 HIT=10+INT(RND(0)*9):RETURN
400 C=2+INT(RND(0)*32):E=15+INT(RND(0)*4):RETURN
500 POSITION 11,2:? "- OUT OF AMMO -":POSITION 14,4:? "press {inv}START{/inv}"
510 IF PEEK(53279)<>6 THEN 510
520 RUN

Download

The original program from the Antic disk, to LOAD or ENTER instead of typing it: STINGRAY.BAS.

Credits