100 init 110 randomize 120 dim cx(100),cy(100),vx(100),vy(100),cc(100) 130 dim px(2),py(2),sc(2),lp(2,4),lb(2),bs(2) 140 for i=1 to 100 step 4 150 sprtex i,4,384,160,416,192 160 sprpal i,1,1,1 170 sprtex i+1,4,416,160,448,192 180 sprpal i+1,1,2,1 190 sprtex i+3,4,448,160,480,192 200 sprpal i+3,1,4,1 210 sprtex i+2,4,480,160,512,192 220 sprpal i+2,1,5,1 230 next i 240 for i=1 to 100 250 cy(i)=250 260 next i 270 bs(1)=10 280 bs(2)=10 290 lb(1)=0 300 lb(2)=0 310 flynum=20 320 stime=30 330 rem ##################### select 340 label select 350 locate 0,0 360 print"上下で時間設定:";stime 370 print"左右で的数設定:";flynum 380 print 390 print"STARTで開始" 400 if pad(1,20)=1 then goto *bws 410 u1=pad(1,3) 420 d1=pad(1,4) 430 l1=pad(1,1) 440 r1=pad(1,2) 450 if u1>20 and u0<=20 and stime>5 then stime=stime+1 460 if d1>20 and d0<=20 and stime<60 then stime=stime-1 470 if l1>20 and l0<=20 and flynum>5 then flynum=flynum-1 480 if r1>20 and r0<=20 and flynum<50 then flynum=flynum+1 490 u0=u1 500 d0=d1 510 l0=l1 520 r0=r1 530 goto *select 540 label bws 550 rem ###################### wait 560 ct=0 570 cs=5 580 label ws 590 clear 600 ct=ct+1 610 if ct>60 then 620 ct=0 630 cs=cs-1 640 if cs<=3 then seplay 2,100,100 650 end if 660 if cs>3 then 670 locate 17,10 680 print"READY" 690 elseif cs>0 then 700 locate 19,10 710 print cs 720 else 730 goto *slines 740 end if 750 fsync 1 760 goto *ws 770 label slines 780 clear 790 pwid=25 800 px(1)=100 810 py(1)=120 820 px(2)=540 830 py(2)=120 840 call setrect(1) 850 call setrect(2) 860 for i=1 to 8 870 if i<=4 then linecol i,255,0,0,128 else linecol i,0,0,255,128 880 linedisp i 890 next i 900 rem ###################### main 910 ct=0 920 label main 930 ct=ct+1 940 if ct>60 then 950 stime=stime-1 960 ct=0 970 if stime<=3 then seplay 3,100,100 980 end if 990 n=int(rnd*flynum)+1 1000 if cy(n)>=250 then 1010 xx=int(rnd*640)-16 1020 vv=rnd*3 1030 if xx>320 then vx(n)=-vv else vx(n)=vv 1040 cx(n)=xx 1050 cy(n)=245 1060 vy(n)=-(rnd*1.6+1) 1070 sprpos n,cx(n),cy(n),n 1080 sprdisp n 1090 cc(n)=1 1100 end if 1110 for i=1 to flynum 1120 if cy(i)<250 then 1130 cx(i)=cx(i)+vx(i) 1140 cy(i)=cy(i)+vy(i) 1150 if cy(i)>=250 or cx(i)<-32 or cx(i)>639 then 1160 cy(i)=250 1170 sproff i 1180 cc(i)=0 1190 else 1200 sprpos i,cx(i),cy(i),i 1210 vy(i)=vy(i)+0.01 1220 end if 1230 end if 1240 next i 1250 call movepad(1) 1260 call movepad(2) 1270 for i=1 to flynum 1280 if cc(i)>=10 then 1290 seplay 38,100,100 1300 sproff i 1310 cy(i)=250 1320 elseif cc(i)>1 then 1330 if vy(i)>0 then vy(i)=-vy(i) else vx(i)=-vx(i) 1340 seplay 16,100,100 1350 end if 1360 cc(i)=1 1370 next i 1380 locate 5,0 1390 textcol red 1400 print"1P:" 1410 locate 28,0 1420 textcol blue 1430 print"2P:" 1440 textcol white 1450 locate 8,0 1460 print sc(1) 1470 locate 31,0 1480 print sc(2) 1490 locate 19,0 1500 print stime 1510 if stime<=0 then goto *gover 1520 fsync 1 1530 goto *main 1540 rem ########################### 1550 label gover 1560 end 1570 rem ################## move-pad 1580 sub movepad(n) 1590 xx=pad(n,14)-127 1600 yy=pad(n,13)-127 1610 if abs(xx)>30 then 1620 px(n)=px(n)+xx/12 1630 if px(n)<0 then px(n)=0 1640 if px(n)>639 then px(n)=639 1650 end if 1660 if abs(yy)>30 then 1670 py(n)=py(n)+yy/24 1680 if py(n)<0 then py(n)=0 1690 if py(n)>229 then py(n)=229 1700 end if 1710 call setrect(n) 1720 pn=0 1730 for i=1 to 4 1740 pp=pad(n,i+4) 1750 if pp>20 and lp(n,i)<=20 then pn=i 1760 lp(n,i)=pp 1770 next i 1780 if pn>0 then 1790 for i=1 to flynum 1800 if cy(i)<250 then 1810 xx=cx(i)+16 1820 yy=cy(i)+8 1830 if xx>=px(n)-pwid and yy>=py(n)-pwid/2 and xx<=px(n)+pwid and yy<=py(n)+pwid/2 then 1840 if mod(i,4)+1=pn then 1850 if lb(n)=pn then bs(n)=bs(n)-1 else bs(n)=10 1860 if bs(n)<3 then bs(n)=3 1870 lb(n)=pn 1880 sc(n)=sc(n)+bs(n) 1890 cc(i)=cc(i)+10 1900 else 1910 sc(n)=sc(n)-3 1920 if sc(n)<0 then sc(n)=0 1930 cc(i)=cc(i)+1 1940 end if 1950 end if 1960 end if 1970 next i 1980 end if 1990 end sub 2000 rem ################## set-rect 2010 sub setrect(n) 2020 sx=px(n)-pwid 2030 ex=px(n)+pwid 2040 sy=py(n)-pwid/2 2050 ey=py(n)+pwid/2 2060 linepos n*4-3,sx,sy,ex,sy,300 2070 linepos n*4-2,sx,ey,ex,ey,300 2080 linepos n*4-1,sx,sy,sx,ey,300 2090 linepos n*4, ex,sy,ex,ey,300 2100 end sub