qbasic/noschool.bas
2021-06-12 20:36:23 -07:00

482 lines
9.9 KiB
QBasic

DEFINT A-Z
DECLARE SUB pause (timeval!)
DECLARE SUB win ()
DECLARE SUB die ()
DECLARE SUB f1 ()
DECLARE SUB f3 ()
DECLARE SUB main ()
DECLARE SUB chrage (z)
DECLARE SUB intro ()
DECLARE SUB framework ()
DECLARE SUB shot ()
DECLARE SUB palett ()
DECLARE SUB e1 ()
DECLARE SUB e2 ()
DECLARE SUB e3 ()
DECLARE SUB e4 ()
DECLARE SUB SCHOOL ()
DATA 196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,180
DATA 000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179
DATA 196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,180
DATA 000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179
DATA 196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,180
DATA 000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179
DATA 196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,180
DATA 000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179
DATA 196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,180
DATA 000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179
DATA 196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,180
DATA 000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179
DATA 196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,180
DATA 000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179
DATA 196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,180
DATA 000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179
DATA 196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,180
DATA 000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179
DATA 196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,197,196,180
DATA 000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179,000,179
'inputs
DIM SHARED crt(1 TO 20, 1 TO 22) AS INTEGER
CLS
SCREEN 13
intro
main
SUB chrage (z)
CLS
SCREEN 12
WIDTH 80, 60
IF z = 1 THEN
LOCATE 1, 1
word$ = "ANALIZING SURFACE . . ."
FOR p = 1 TO LEN(word$)
LOCATE 1, p
PRINT MID$(word$, p, 1)
PLAY "o1t255l20b"
pause .01
IF INKEY$ <> "" THEN GOTO 9
NEXT p
LOCATE 3, 1
word$ = "Welcome to Earth."
FOR p = 1 TO LEN(word$)
PRINT MID$(word$, p, 1);
PLAY "o1t255l20b"
pause .01
IF INKEY$ <> "" THEN GOTO 9
NEXT p
LOCATE 5, 1
word$ = "You are controlling the UFO. Target the school's grid coordinates before nuclear counterstrikes target you! Arbitrary proximity sensors will tell you how close each shot is. Good luck . . . "
FOR p = 1 TO LEN(word$)
PRINT MID$(word$, p, 1);
PLAY "o1t255l20b"
pause .01
IF INKEY$ <> "" THEN GOTO 9
NEXT p
9
'IF z = 1 THEN
FOR h = 1 TO 20
FOR i = 1 TO 22
READ crt(h, i)
NEXT i
NEXT h
END IF
'output
FOR n = 1 TO 20
FOR o = 1 TO 22
LOCATE 10 + n, 1 + o
PRINT CHR$(crt(n, o))
'IF z = 1 THEN pause .00005
NEXT o
NEXT n
FOR l = 1 TO 10
LOCATE 9, l * 2 + 2
PRINT CHR$(64 + l)
NEXT l
FOR n = 1 TO 10
LOCATE 10 + n * 2, 1
PRINT n - 1
NEXT n
END SUB
SUB die
SCREEN 13
CIRCLE (200, 100), 50, 4, , , .5
PAINT (200, 100), 4, 4
CIRCLE (200, 100), 25, 5, , , .7
PAINT (200, 100), 5, 5
rocket$ = "c4u1l1d4r4u4l4r4c7r10f2g2l10"
FOR i = 1 TO 200
PSET (i, 100), 4
DRAW "X" + VARPTR$(rocket$)
PAINT (i, 100), 4, 4
pause .01
NEXT i
FOR t = 1 TO 120
CIRCLE (200 + t, 100), t / 3 + 50, 4
NEXT t
FOR i = 1 TO 63
c = 64 - i
PALETTE 4, c
NEXT i
CLS
SCREEN 12
COLOR 15
LOCATE 1, 1
PRINT "YOU HAVE BEEN HIT!!!"
SLEEP
SYSTEM
END SUB
SUB e1
'184,-3,-4,-5,64
FOR i = 1 TO 400
x = INT(RND * 60) + 131
y = INT(RND * 25) + 176
PSET (x, y), 65
NEXT i
FOR i = 1 TO 20
a = INT(RND * 220) + 51
b = INT(RND * 30) + 171
debris$ = "c184r3d3l2c183d2r1l1u4"
PSET (a, b), 185: DRAW "X" + VARPTR$(debris$)
NEXT i
FOR i = 1 TO 100
c = INT(RND * 220) + 51
d = INT(RND * 30) + 171
debris$ = "c183r1d1l2c184d1r3"
PSET (c, d), 185: DRAW "X" + VARPTR$(debris$)
NEXT i
FOR i = 1 TO 500
e = INT(RND * 220) + 51
f = INT(RND * 30) + 171
PSET (e, f), 64
NEXT i
END SUB
SUB e2
LINE (57, 2)-(57, 13), 49
LINE (63, 2)-(63, 13), 49
LINE (56, 3)-(56, 10), 50
LINE (64, 3)-(64, 10), 50
LINE (55, 6)-(55, 7), 51
LINE (65, 6)-(65, 7), 51
DIM pic(55 TO 65, 2 TO 13) AS INTEGER
GET (55, 2)-(65, 13), pic
LINE (57, 2)-(57, 13), 0
LINE (63, 2)-(63, 13), 0
LINE (56, 3)-(56, 10), 0
LINE (64, 3)-(64, 10), 0
LINE (55, 6)-(55, 7), 0
LINE (65, 6)-(65, 7), 0
FOR p = 0 TO 170
PUT (155, p), pic, XOR
PUT (155, p), pic, XOR
NEXT p
END SUB
SUB e3
'185,184,183,182
FOR r = 0 TO 30
CIRCLE (250, 200), r + 20, 185 - r / 10, 0, 2
CIRCLE (220, 200), r + 15, 185 - r / 10, 1, 2
CIRCLE (170, 190), r + 15, 185 - r / 10, 0, 3
CIRCLE (140, 185), r + 5, 185 - r / 10, 1, 3
CIRCLE (100, 185), r + 20, 185 - r / 10, .5, 3
CIRCLE (60, 200), r + 5, 184 - r / 10, .5, 4
NEXT r
e1
END SUB
SUB e4
LINE (150, 0)-(170, 155), 0, BF
'49,50,51,46,45,44
'15,64,183,184,185
FOR i = 1 TO 63 STEP 10
a = 64 - i
PALETTE 15, a
PALETTE 64, a
PALETTE 65, a
PALETTE 181, a
PALETTE 182, a
PALETTE 183, a
PALETTE 184, a
PALETTE 185, a
PALETTE 45, a
PALETTE 46, a
pause .005
NEXT i
PALETTE 15, 0
PALETTE 64, 0
PALETTE 65, 0
PALETTE 181, 0
PALETTE 182, 0
PALETTE 183, 0
PALETTE 184, 0
PALETTE 185, 0
PALETTE 45, 0
PALETTE 46, 0
END SUB
SUB f1
FOR i = 1 TO 50
x = INT(RND * 60) + 131
y = INT(RND * 25) + 176
PSET (x, y), 65
NEXT i
FOR i = 1 TO 50
e = INT(RND * 80) + 111
f = INT(RND * 10) + 171
PSET (e, f), 64
NEXT i
END SUB
SUB f3
FOR r = 0 TO 100
CIRCLE (200, 200), r / 3, 185 - r / 34, 0, 2
CIRCLE (140, 200), r / 3, 185 - r / 34, 1, 3
CIRCLE (170, 200), r / 3, 185 - r / 34, 0, 3
NEXT r
END SUB
SUB framework
LINE (60, 175)-(260, 200), 0, BF
LINE (160 - 100, 200)-(160 - 20, 180), 184, BF
LINE (160 - 20, 200)-(160 + 20, 175), 183, BF
LINE (160 + 20, 200)-(160 + 100, 180), 184, BF
FOR i = 1 TO 20 STEP 9
FOR o = 1 TO 75 STEP 7
LINE (60 + o, 180 + i)-(65 + o, 185 + i), 65, BF
NEXT o
NEXT i
FOR i = 1 TO 20 STEP 9
FOR o = 1 TO 75 STEP 7
LINE (255 - o, 180 + i)-(260 - o, 185 + i), 65, BF
NEXT o
NEXT i
END SUB
SUB intro
CIRCLE (100, 100), 30, 2
PAINT (100, 100), 1, 2
FOR i = 1 TO 80
CIRCLE (200 - i, 200 - i), 10 - i / 10, 4, , , .5
PAINT (200 - i, 200 - i), 4, 4
CIRCLE (200 - i, 200 - i), 5 - i / 20, 5, , , .5
PAINT (200 - i, 200 - i), 5, 5
pause .001
CIRCLE (200 - i, 200 - i), 10 - i / 10, 0, , , .5
IF INKEY$ <> "" THEN GOTO 8
NEXT i
8
CLS
END SUB
SUB main
z = 1
chrage (z)
z = 0
chrage (z)
RANDOMIZE TIMER
acr = INT(RND * 10)
across$ = CHR$(acr + 97)
down = INT(RND * 10)
acr = INT(RND * 10)
yacross$ = CHR$(acr + 97)
ydown = INT(RND * 10)
DO
LOCATE 5, 5
PRINT "Enter Letter"
DO
l$ = INKEY$
IF LEN(l$) <> 1 THEN l$ = " "
IF l$ = CHR$(27) OR l$ = CHR$(13) OR l$ = "q" THEN SYSTEM
l$ = LCASE$(l$)
LOOP UNTIL ASC(l$) >= 97 AND ASC(l$) <= 106
LOCATE 7, 5
PRINT "Enter Number"
DO
n$ = INKEY$
IF LEN(n$) <> 1 THEN n$ = " "
IF n$ = CHR$(27) OR n$ = CHR$(13) OR n$ = "q" THEN SYSTEM
LOOP UNTIL ASC(n$) >= 48 AND ASC(n$) <= 57
dist = INT(SQR(ABS(ASC(l$) - ASC(across$)) ^ 2 + ABS(VAL(n$) - down) ^ 2)) + 48
IF dist >= 58 THEN dist = 45
crt((VAL(n$) + 1) * 2, 2 * (ASC(l$) - 96) + 1) = dist
IF l$ = across$ AND VAL(n$) = down THEN SCREEN 13: SCHOOL: SLEEP 1: shot: framework: e1: e2: e3: e4: win: SYSTEM ELSE SCREEN 13: SLEEP 1: shot: f1: e2: f3: e4: SCREEN 12: chrage (z)
'LOCATE 1, 1: PRINT across$: PRINT down
LOCATE 45, 5
COLOR 12
PRINT "Automatic anti-UFO weapons systems are now firing at you! Please wait."
pause .5
LOCATE 45, 5
PRINT " "
pause .1
LOCATE 45, 5
COLOR 12
PRINT "Automatic anti-UFO weapons systems are now firing at you! Please wait."
pause .5
LOCATE 45, 5
PRINT " "
k = INT(RND * 10): l$ = CHR$(k + 97)
n = INT(RND * 10)
IF l$ = yacross$ AND n = ydown THEN die
k = INT(RND * 10): l$ = CHR$(k + 97)
n = INT(RND * 10)
IF l$ = yacross$ AND n = ydown THEN die
k = INT(RND * 10): l$ = CHR$(k + 97)
n = INT(RND * 10)
IF l$ = yacross$ AND n = ydown THEN die
k = INT(RND * 10): l$ = CHR$(k + 97)
n = INT(RND * 10)
IF l$ = yacross$ AND n = ydown THEN die
LOOP
END SUB
DEFSNG A-Z
SUB pause (timeval)
w = TIMER + timeval
DO
LOOP UNTIL TIMER > w
END SUB
DEFINT A-Z
SUB SCHOOL
LINE (160 - 100, 200)-(160 - 20, 180), 184, BF
LINE (160 - 20, 200)-(160 + 20, 175), 183, BF
LINE (160 + 20, 200)-(160 + 100, 180), 184, BF
FOR i = 1 TO 20 STEP 9
FOR o = 1 TO 75 STEP 7
LINE (60 + o, 180 + i)-(65 + o, 185 + i), 0, BF
NEXT o
NEXT i
FOR i = 1 TO 20 STEP 9
FOR o = 1 TO 75 STEP 7
LINE (255 - o, 180 + i)-(260 - o, 185 + i), 0, BF
NEXT o
NEXT i
PSET (151, 177), 15
PSET (152, 176), 15
PSET (152, 178), 15
PSET (151, 179), 15
PSET (155, 177), 15
PSET (154, 178), 15
PSET (155, 179), 15
PSET (157, 176), 15
PSET (157, 177), 15
PSET (157, 178), 15
PSET (157, 179), 15
PSET (158, 178), 15
PSET (159, 178), 15
PSET (159, 179), 15
PSET (161, 177), 15
PSET (161, 178), 15
PSET (161, 179), 15
PSET (163, 177), 15
PSET (163, 178), 15
PSET (163, 179), 15
PSET (162, 177), 15
PSET (162, 179), 15
PSET (165, 177), 15
PSET (165, 178), 15
PSET (165, 179), 15
PSET (167, 177), 15
PSET (167, 178), 15
PSET (167, 179), 15
PSET (166, 177), 15
PSET (166, 179), 15
PSET (169, 176), 15
PSET (169, 177), 15
PSET (169, 178), 15
PSET (169, 178), 15
PSET (169, 179), 15
COLOR 7
man$ = "e3f3h3u3r2l4r2e2h2g2f2"
PSET (300, 200)
DRAW "X" + VARPTR$(man$)
PSET (310, 200)
DRAW "x" + VARPTR$(man$)
END SUB
SUB shot
'40-43
'49,50,51,46,45,44
LINE (158, 0)-(158, 200), 46
LINE (159, 0)-(159, 200), 45
LINE (160, 0)-(160, 200), 44
LINE (161, 0)-(161, 200), 45
LINE (162, 0)-(162, 200), 46
END SUB
SUB win
LOCATE 20, 21
COLOR 7
LINE (300, 187)-(270, 160)
PRINT "Way cool man!"
SLEEP
CLS
COLOR 14
LOCATE 1, 1
SCREEN 12
PRINT "THE SCHOOL HAS BEEN ELIMINATED - GOOD WORK, RETURN TO BASE!"
SLEEP
END SUB