mirror of
https://github.com/inexorabletash/jsbasic.git
synced 2024-12-22 07:30:19 +00:00
43 lines
3.1 KiB
Plaintext
43 lines
3.1 KiB
Plaintext
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= 12 - R * 3: PLOT U,V
|
|
25 IF U = E AND V = E THEN PRINT B$;:BR = BR - I: VTAB 22: HTAB 40: PRINT BR;: POKE 49233,0: FOR T = I 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
|
|
58 N = (NN = I) + N:NN = NN - NOT NOT NN:K = K + WV:K = (K < N) * K:U = ABS (U(K)) - I:V = V(K):R = (U(K) < Z) + I
|
|
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:U(K) = SGN(U(K)) * (U + I):V(K) = V: 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: DEF FN M(T) = ( PEEK (49250) > 127) * 2 + ( PEEK (49249) > 127)
|
|
105 INVERSE : PRINT " SPACE ATTACK! ": NORMAL : PRINT : HTAB 13: PRINT "BY ALAN RATLIFF"
|
|
110 VTAB 7: PRINT " USE THE [MOUSE] TO HIT THE ENEMY": PRINT " MISSILES BEFORE THEY HIT YOUR GREEN": PRINT " BASE---WATCH OUT FOR THE FAST BLUE": PRINT " MISSILES! (WHICH SCORE DOUBLE)"
|
|
115 VTAB 12: PRINT " THE FARTHER FROM BASE YOU HIT THE": PRINT " MISSILES, THE MORE YOU SCORE."
|
|
120 VTAB 15: 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 [HOME] FOR THE FIRST ATTACK WAVE;": PRINT "PRESS [END] FOR THE SECOND ATTACK WAVE.";
|
|
135 T = FN M(0): IF NOT T GOTO 135
|
|
140 Z = 0:I = 1:D = I / 6.7:D2 = I / 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 :WV = T = 2:S = Z: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)):N = I:K = Z
|
|
155 GOSUB 90
|
|
165 VTAB 22: HTAB 15: PRINT SPC( 10):T = Z
|
|
170 FOR X = Z TO T: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:T = N * X + K * NOT X: U(T) = (3 - R * 2) * (U + I):V(T) = V: NEXT : 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 ((WV / 10 + .8) * H * N / (N + WV)):M = M + WV + I:NN = (N + 10) * WV:T = WV: GOTO 170
|
|
220 PRINT "PRESS [HOME] FOR NEW FIRST WAVE, [END]": PRINT "FOR NEW SECOND WAVE; ANY OTHER KEY:EXIT";
|
|
225 T = FN M(Z): IF T GOTO 145
|
|
230 IF PEEK (49152) < 128 GOTO 225
|
|
235 POKE 49168,Z: HTAB I: VTAB 23: CALL - 958: PRINT : PRINT "BYE FOR NOW!";
|