Artillery Practice

See all articles from The Plotter v4 n1
Author(s): Dick Wagner
Publication: The Plotter
Pub Details: The Plotter v4 n1 (Volume 4, Issue 1)
Date: January 1985
Pages: 4

This game requires the player to enter the gun firing force and the angle for firing. By trial you can arrive at values you can work with. Too much force puts you off the screen. The misses keep adding up until there is a hit. At times it appears that the target is not repositioned which is possible because of the random function.

This game is based on a program in the book. The Art of Programming the ZX Spectrum, from the Bambi press.

   5 PRINT AT 0,5;"Artillary Practice"
10 LET b=30
20 GO SUB 300
30 INPUT "Force= ";f
40 LET f=f/2
50 INPUT "Angle= ";t
60 LET h=f*COS (t*PI/180)
70 LET v=f*SIN (t*PI/180)
80 LET x=0
90 LET y=b
100 PLOT x,y: PLOT x,y+1
110 LET v=v-.1
120 PLOT INVERSE 1,x,y: PLOT INVERSE 1,x,y+1
130 LET x=x+h
140 LET y=y+v
150 IF y<=b THEN GO TO 200
160 IF x>255 OR y>150 THEN GO TO 200
170 GO TO 100
200 IF x>=p AND x<=p+10 THEN GO TO 250
210 LET m=m+1
220 GO TO 260
250 BEEP .2,.10: LET s=s+1
260 PRINT AT 1,0;"Hit=";s;" Miss=";m;" "
270 IF s>=1 THEN GO TO 370
280 GO TO 30
300 LET p=RND*100+100
310 PLOT p,b
320 DRAW 10,0
330 LET m=0
340 LET s=0
360 GO TO 30
370 PLOT INVERSE 1,p,b
375 INVERSE 1: DRAW 10,0
380 INVERSE 0
390 GO TO 20

Transcription note: the listing is corrected so it runs. As printed, line 150 reads G0 TO (with a zero), which stops the program; corrected to GO TO.

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