Add sample: Space Attack by Alan Ratliff

This commit is contained in:
Joshua Bell 2020-06-13 10:46:11 -07:00
parent 45aa654f0c
commit dd01e4c9f1
2 changed files with 42 additions and 0 deletions

View File

@ -82,6 +82,7 @@ By <a target=_blank href="mailto:inexorabletash@gmail.com">Joshua Bell</a>
<option value="sample.dragonsmaze">&nbsp; Dragon's Maze (Russell Hokanson)</option>
<option value="sample.blackhole">&nbsp; Black Hole Maze (S.M.Compton c/o Melody Ayres-Griffiths)</option>
<option value="sample.chase">&nbsp; Chase (Dominik Heidler)</option>
<option value="sample.spaceattack">&nbsp; Space Attack! (Alan Ratliff)</option>
<option disabled>____________________________________________</option>
<option disabled>Graphics</option>

View File

@ -0,0 +1,41 @@
10 GOTO 100: REM SPACE ATTACK! BY ALAN RATLIFF, (C) 1979 & 2020
15 REM ADAPTED FOR "Applesoft BASIC in Javascript"
20 T = SCRN( U,V) = W: COLOR= RC: PLOT U,V
25 IF U = E AND V = E THEN PRINT B$;:BR = BR - 1: VTAB 22: HTAB 40: PRINT BR;: POKE 49233,0: FOR T = 1 TO 800: NEXT: POKE 49232,0: ON 1 + NOT BR GOTO 155,220
30 IF T THEN COLOR= W: PLOT U,V: GOTO 190
40 X = INT ( PDL(Z) * D):Y = INT ( PDL(I) * D2): IF Y > 38 THEN Y = 38
50 IF X < > P OR Y < > Q THEN COLOR= Z: GOSUB 95:P = X:Q = Y: GOSUB 90: IF SCRN( U,V) = W GOTO 190
55 L = (L + I) * (L < H): IF L GOTO 40
60 B = (R - ( ABS (E - U) < R)) * SGN (E - U):C = (R - (ABS (E - V) < R)) * SGN (E - V)
70 IF B AND C THEN B = ( ABS ((E - V) / (E - U)) < J) * B:C = ( ABS ((E - U) / (E - V)) < J) * C
80 COLOR= Z: PLOT U,V: U = U + B:V = V + C: GOTO 20
90 COLOR= G: PLOT E,E: COLOR= W
95 HLIN P,P + I AT Q: HLIN P,P + I AT Q + I: RETURN
100 PR# 0: TEXT : HOME : VTAB 2: HTAB 13
105 INVERSE : PRINT " SPACE ATTACK! ": NORMAL : PRINT : HTAB 13: PRINT "BY ALAN RATLIFF"
110 VTAB 7: PRINT " HIT THE ENEMY MISSILES BEFORE THEY HIT": PRINT " YOUR GREEN BASE---WATCH OUT FOR THE": PRINT " FAST BLUE ONES! (WHICH SCORE DOUBLE)"
115 VTAB 11: PRINT " THE FARTHER FROM BASE YOU HIT THE": PRINT " MISSILES, THE MORE YOU SCORE."
120 VTAB 14: PRINT " GET A BONUS BASE EVERY 2000 POINTS!"
122 PRINT " (BUT THE MISSILES COME FASTER....": HTAB 9: PRINT "AND SCORE MORE POINTS!)"
125 VTAB 19: PRINT "THE GAME ENDS WHEN THE MISSILES HAVE HITFIVE BASES (PLUS BONUS BASES)."
130 VTAB 23: PRINT "PRESS THE [HOME KEY] TO BEGIN..."
135 IF PEEK (49249) < 128 GOTO 135
140 Z = 0:I = 1:D = 1 / 6.7:D2 = 1 / 5.5:G = 12:W = 15:E = 20:J = 2:F = 58.5:B$ = CHR$ (7)
142 HOME : VTAB 11: HTAB 19: PRINT "BOOM!"
145 GR : HOME :S = 0:M = 5:H = 80:P = INT (PDL (Z) * D):Q = INT ( PDL (I) * D2): IF Q > 38 THEN Q = 38
150 VTAB 22: PRINT "SCORE: 0" TAB( 28)"BASES LEFT: 5";:BR = 5
152 R = RND ( - PEEK (79) * 999 - PEEK (78))
155 GOSUB 90
165 VTAB 22: HTAB 15: PRINT SPC( 10)
170 R = INT ( RND (I) * 156):U = (F - ABS (R - F)) * (R < 117): IF U > 39 THEN U = 39
175 V = (F - ABS (R - 97.5)) * (R > 39): IF V > 39 THEN V = 39
185 R = INT ( RND (I) * 1.1) + I:RC = 12 - R * 3: GOTO 20
190 U = U - E:V = V - E:SC = INT ( SQR (U * U + V * V) - I) * R * M
195 S = S + SC: VTAB 22: HTAB 8: PRINT S;B$
205 IF INT (S / 2E3) = INT ((S - SC) / 2E3) GOTO 165
210 FLASH : VTAB 22: HTAB 15: PRINT "BONUS BASE"B$;: NORMAL
215 BR = BR + I: HTAB 40: PRINT BR;: H = INT (H * .8):M = M + I: GOTO 170
220 PRINT "PRESS [HOME KEY] TO PLAY AGAIN,": PRINT "OR ANY OTHER KEY TO EXIT.";
225 IF PEEK (49249) > 127 GOTO 145
230 IF PEEK (49152) < 128 GOTO 225
235 POKE 49168,0: HTAB I: VTAB 23: CALL - 958