REM ibm pc spinout
REM K.R. Sloan, Jr.
REM 1 January 1982
DIM BALL(14)
DIM PADDLE(9)
DIM BRICK(20, 4)
RANDOMIZE (VAL(RIGHT$(TIME$, 2)))
KEY OFF: PLAY "mb"
LOUD = 0
BRUNO$ = "l16o2b-o3cl8ddc+16do2fp1"
T = 8: B = 188: L = 8: R = 308
BH = 8: BW = (R - L) / 20
BT = T + (BH * 4): BB = BT + (BH * 4)
CLS
LOCATE 7, 12: PRINT "Welcome to Spinout";
LOCATE 8, 12: PRINT "ArchMach Version 1";
160 LOCATE 12, 1: PRINT "Choose a key to move the paddle right";
170 R$ = INKEY$: IF R$ = "" GOTO 170
LOCATE 12, 1: PRINT "Choose a key to move the paddle left ";
190 L$ = INKEY$: IF L$ = "" GOTO 190
IF R$ = L$ GOTO 160
LOCATE 12, 1: PRINT "Choose a key to serve ";
220 S$ = INKEY$: IF S$ = "" GOTO 220
IF (R$ = S$) OR (L$ = S$) GOTO 160
LOCATE 12, 1: PRINT "Choose a key to turn noise on/off ";
250 N$ = INKEY$: IF N$ = "" GOTO 250
IF (R$ = N$) OR (L$ = N$) OR (S$ = N$) GOTO 160
270 LOCATE 12, 1: INPUT ; "How good are you at this game (1-10)"; SKILL
IF SKILL < 1 GOTO 270
IF SKILL > 10 GOTO 270
SKILL = SKILL / 10
MAXVX = 6 + (4 * SKILL): MAXVY = MAXVX
G = SKILL / 5
DEF SEG = 0: EQUIPMENT% = PEEK(&H410): POKE &H410, EQUIPMENT% - &H10
WIDTH 40: WIDTH 80: SCREEN 0, 0, 0: SCREEN 1: COLOR 1, 0: CLS
LINE (0, 0)-(319, 199), 0, BF
FOR BY = 0 TO 3
FOR BX = 0 TO 19
BRICK(1 + BX, 1 + BY) = 10 + 50 * BY
LINE (L + 2 + (BW * BX), BT + 2 + (BH * BY))-STEP(BW - 4, BH - 4), 2 + INT(BY / 2), BF
NEXT BX, BY
SCORE = 0
LINE (L, T)-(R, T)
LINE -(R, B)
LINE -(L, B)
LINE -(L, T)
X = 160: Y = 100
LASTD$ = ""
FOR I = 1 TO 5
FOR J = 1 TO 5
IF ((I - 3) * (I - 3)) + ((J - 3) * (J - 3)) < 6.25 THEN PSET (X - 3 + I, Y - 3 + J)
NEXT J, I
GET (X - 2, Y - 2)-(X + 2, Y + 2), BALL
PL = 150: PR = 170: PY = B - 20
LINE (PL, PY)-(PR, PY), 1, BF
GET (PL, PY)-(PR, PY), PADDLE
REM main loop
IF LOUD = 1 THEN PLAY BRUNO$
FOR SHOT = 1 TO 4
LOCATE 25, 1
PRINT USING "#####"; SCORE;
LOCATE 25, 8
PRINT USING "Ball # "; SHOT;
LOCATE 25, 18
PRINT "K.R.Sloan,Jr. 1Jan82";
IF X > R THEN X = R
IF X < L THEN X = L
IF Y < T THEN Y = T
IF Y > B THEN Y = B
PUT (X - 2, Y - 2), BALL
X = L + RND(X) * (R - L)
Y = B - 10
PUT (X - 2, Y - 2), BALL
VX = 6 * RND(1) - 3
VY = -5 - 2 * RND(1)
SPIN = 0
FAST = 1 + SKILL
720 GOSUB 1410 'MOVE PADDLE
IF D$ <> S$ GOTO 720
740 OX = X: OY = Y: OBX = BX: OBY = BY
OVX = VX: OVY = VY
VX = OVX - (SPIN * OVY * .05): VY = OVY + (SPIN * OVX * .05) + G
SPIN = SPIN * .9999
IF VX > MAXVX THEN VX = MAXVX
IF VY > MAXVY THEN VY = MAXVY
IF VX < -MAXVX THEN VX = -MAXVX
IF VY < -MAXVY THEN VY = -MAXVY
X = X + VX: Y = Y + VY
BX = INT((X - L) / BW)
IF BX > 19 THEN BX = 19
IF BX < 0 THEN BX = 0
BY = INT((Y - BT) / BH)
IF BY > 3 GOTO 1050
IF BY < 0 GOTO 1050
IF BRICK(1 + BX, 1 + BY) <= 0 GOTO 1050
IF BY > 1 GOTO 890
VY = VY * FAST
890 IF (OBX <> BX) THEN VX = -VX
IF (OBY <> BY) THEN VY = -VY
SCORE = SCORE + BRICK(1 + BX, 1 + BY)
SOUND 440, 2 * LOUD
PUT (OX - 2, OY - 2), BALL, XOR
LINE (L + 2 + (BW * BX), BT + 2 + (BH * BY))-STEP(BW - 4, BH - 4), 0, BF
PUT (OX - 2, OY - 2), BALL, XOR
BRICK(1 + BX, 1 + BY) = -BRICK(1 + BX, 1 + BY)
IF SCORE < 6800 GOTO 1050
LOCATE 25, 1
PRINT USING "#####"; SCORE;
FOR FLASH = 1 TO 8
COLOR FLASH, .5 + RND(FLASH)
PLAY "mfaemb"
NEXT FLASH
GOTO 1340
1050 IF X <= L THEN X = L + L - X: VX = -VX: VY = VY + SPIN: SOUND 600, 2 * LOUD
IF X >= R THEN X = R + R - X: VX = -VX: VY = VY - SPIN: SOUND 1200, 2 * LOUD
IF Y <= T THEN Y = T + T - Y: VY = -VY: VX = VX - SPIN: SOUND 880, 2 * LOUD
IF Y >= B GOTO 1310
IF (Y < PY) OR (OY > PY) THEN GOTO 1270
IF ((PL - 2) < X) AND (X < (PR + 2)) GOTO 1130
IF ((PL - 2) < OX) AND (OX < (PR + 2)) GOTO 1130
GOTO 1270
1130 Y = PY + PY - Y
SOUND 300, 5 * LOUD
IF (RND(1) * 2) > SKILL GOTO 1210
BX = INT(RND(1) * 19.99): BY = INT(RND(1) * 3.99):
IF BRICK(1 + BX, 1 + BY) > 0 GOTO 1210
BRICK(1 + BX, 1 + BY) = -BRICK(1 + BX, 1 + BY)
LINE (L + 2 + (BW * BX), BT + 2 + (BH * BY))-STEP(BW - 4, BH - 4), 2 + INT(BY / 2), BF
SCORE = SCORE - BRICK(1 + BX, 1 + BY)
1210 LOCATE 25, 1
PRINT SCORE;
VY = -VY
MISS = (X - (PL + PR) / 2) / (PL - PR)
VX = VX + VY * MISS * SKILL * 5
SPIN = (SPIN * SKILL) + MISS * SKILL
1270 PUT (X - 2, Y - 2), BALL, XOR
PUT (OX - 2, OY - 2), BALL, XOR
TIMER ON
Start = TIMER
DO
LOOP UNTIL TIMER > Start + .1
TIMER OFF
GOSUB 1410 'move paddle
GOTO 740
1310 REM lost ball
IF LOUD = 1 THEN SOUND 200, 20
NEXT SHOT
1340 REM End of Game
DEF SEG = 0: POKE &H410, 125: WIDTH 40: WIDTH 80: SCREEN 0, 0, 0
WIDTH 80: SCREEN 0, 0, 0
LOCATE 12, 20
PRINT "Do you want to play another game?\";
1370 D$ = INKEY$
IF D$ = "y" THEN RUN
IF D$ = "n" THEN STOP
GOTO 1370
1410 REM move paddle routine
OPL = PL
1430 D$ = INKEY$
IF D$ = CHR$(27) THEN END
IF D$ = N$ THEN LOUD = -1 * LOUD + 1
IF D$ = L$ THEN PL = PL - 5: GOTO 1430
IF D$ = R$ THEN PL = PL + 5: GOTO 1430
IF PL < L THEN PL = L
IF PL > (R - 20) THEN PL = R - 20
IF OPL = PL THEN RETURN
PR = PL + 20
PUT (OPL, PY), PADDLE, XOR
PUT (PL, PY), PADDLE, XOR
RETURN
No comments:
Post a Comment