時間に余裕があった年にやってみたブロック崩しとラケットの角返しを追加して、その他数か所修正してみたもの。とりあえず、ちゃんとブロック崩しとして遊べるものになっていると思う。
コメント行 「ブロックの初期化と表示」 のところ
コメント行 「ボールがブロックの上下にラインに来たら *BCHECK へ」 のところ
コメント行 「ブロックが存在したら消して跳ね返す」 のところ
コメント行 「ブロックが無かったら再描画フラッグを立ててリターン」 と 「ブロックライン通過時のブロック再描画判定」 のところ
コメント行 「ラケットに当たったら移動方向を反転」 の2行下 590 行目
100 cls 110 '--- 壁を描く 120 locate 19,1 130 color 4 140 print "#########################################" 150 for I=2 to 22 160 locate 19,I 170 print "# #" 180 next I 190 color 7 200 '--- ボール座標 X,Y 移動方向 XM,YM 210 X=40:Y=7:XM=1:YM=1 220 '--- ラケットの座標 BX,BY 移動方向 BM 230 BX=38:BY=22:BM=0 240 '--- ボールの個数とスコアの表示 250 BALL=3:SCORE=0 260 locate 20,0:print "Score: ";SCORE 270 locate 51,0:print "Ball: ";BALL 280 '--- ブロックの初期化と表示 290 DIM BL(12,1):BLY=5:f0=0 300 for I=0 to 12 310 BL(I,0)=20+I*3:BL(I,1)=1 320 if (I mod 2)=0 then color 3 else color 5 330 locate BL(I,0),BLY 340 print "@@@" 350 next I 360 color 7 370 '--- 最初のラケットの表示 380 locate BX,BY:print "===" 390 '--- ゲーム開始メッセージ 400 gosub *START 410 '--- メインループ 持ち球がある間はゲームが続く 420 while BALL>0 430 '--- ボールを表示 440 locate X,Y:print "o" 450 '--- ブロックライン通過時のブロック再描画判定 460 if f0>0 then f0=f0-1:if f0=0 then gosub *PBLOCK 470 '--- ボールの速度調整 480 for I=0 to 50 490 '--- 押されているキーを読み取る 500 K$=inkey$ 510 '--- 左右(,.)のキーが押されていたら移動方向をセットして *MOVE へ 520 if K$="," and BX>20 then BM=-1:gosub *MOVE 530 if K$="." and BX<56 then BM=+1:gosub *MOVE 540 next I 550 '--- ボールがブロックの上下ラインに来たら *BCHECK へ 560 if (YM=1 and Y=BLY-1) or (YM=-1 and Y=BLY+1) then gosub *BCHECK 570 '--- ラケットに当たったらボールの移動方向を反転 580 if Y=BY-1 and X>=BX-1 and X<=BX+3 then YM=-YM:gosub *SCORE 590 if Y=BY-1 and ((XM=1 and X=BX-1) or (XM=-1 and X=BX+3)) then XM=-XM 600 '--- 上下左右の壁に当たったら移動方向を反転 610 if Y=2 then YM=-YM 620 if X=20 or X=58 then XM=-XM 630 '--- ボールを消す 640 locate X,Y:print " " 650 '--- ミスした 660 if Y=BY+1 then gosub *MISS 670 '--- 次のボール座標を計算 680 X=X+XM:Y=Y+YM 690 wend 700 locate 34,12:print "Game Over..." 710 for I=0 to 50000:next I 720 end 730 '--- ラケットを表示するサブルーチン 740 *MOVE 750 '--- ラケットを消す 760 locate BX,BY:print " " 770 '--- ラケットの座標を計算して表示 780 BX=BX+BM 90 locate BX,BY:print "===" 800 return 810 '--- ミスしたときのサブルーチン 820 *MISS 830 locate 36,12:print "Booo!!" 840 for I=1 to 20000:next I 850 BALL=BALL-1 860 locate 51,0:print "Ball: ";BALL 870 locate 36,12:print " " 880 Y=10:YM=-1 890 return 900 '--- スコア表示 910 *SCORE 920 SCORE=SCORE+100 930 locate 20,0:print "Score: ";SCORE 940 if (SCORE mod 500)=0 then BALL=BALL+1:locate 51,0:print "Ball: ";BALL 950 return 960 '--- ゲーム開始メッセージ 970 *START 980 locate 31,12:print "Ready..." 990 for I=1 to 15000:next I 1000 locate 41,12:print "Go!!!" 1010 for I=1 to 15000:next I 1020 locate 31,12:print " " 1030 for I=1 to 5000:next I 1040 return 1050 '--- ブロックが存在したら消して跳ね返す 1060 *BCHECK 1070 BLN=int((X-BL(0,0))/3) 1080 '--- ブロックが無かったら再描画フラッグを立ててリターン 1090 if BL(BLN,1)=0 then f0=2:return 1100 BL(BLN,1)=0 1110 locate BL(BLN,0),BLY 1120 print " " 1130 YM=-YM 1140 SCORE=SCORE+400:gosub *SCORE 1150 return 1160 '--- ブロックの再描画 1170 *PBLOCK 1180 for I=0 to 12 1190 if (I mod 2)=0 then color 3 else color 5 1200 if BL(I,1)=1 then locate BL(I,0),BLY:print "@@@" 1210 next I 1220 color 7 1230 return