100 init 110 mode=1 120 print"SELECTでモード選択" 130 print" STARTで開始" 140 label setmode 150 locate 0,3 160 if mode=1 then print"1 player " else print"2 players" 170 fsync 1 180 sl=pad(1,19) 190 if sl=1 and s0=0 then mode=3-mode 200 s0=sl 210 if pad(1,20)=0 then goto *setmode 220 clear 230 rem ######################## init 240 campos 1,200,-100,-600 250 bgcol 0,30,50 260 miss=0 270 size=400 280 side=1 290 sx=0 300 ex=400 310 sz=400 320 ez=-400 330 getspos x1,y1,z1,1,sx,0,sz 340 getspos x2,y2,z2,1,ex,0,sz 350 getspos x3,y3,z3,1,sx,0,ez 360 getspos x4,y4,z4,1,ex,0,ez 370 linepos 1,x1,y1,x2,y2,0 380 linepos 2,x2,y2,x4,y4,0 390 linepos 3,x1,y1,x3,y3,0 400 linepos 4,x3,y3,x4,y4,0 410 linepos 5,x1,y1,x1,0,0 420 linepos 6,x2,y2,x2,0,0 430 for i=1 to 6 440 linecol i,100,100,100,128 450 linedisp i 460 next i 470 rg1=80 480 rg2=40 490 dim mx(2),mz(2),md(2),a0(2),b0(2),c0(2),score(2) 500 mx(1)=100 510 my=-20 520 mx(2)=300 530 for i=1 to mode 540 mz(i)=0 550 md(i)=pi 560 modset i,8,i 570 modpos i,mx(i),my,mz(i) 580 modrot i,0,md(i),0 590 moddisp i 600 score(i)=0 610 next i 620 br=5 630 bx=100 640 by=-100 650 bz=-300 660 spz1=5.4 670 spz2=8.4 680 spy1=-1.5 690 spy2=-2.5 700 bvx=2.4 710 bvy=-1.5 720 bvz=5.4 730 modset 3,1,9 740 modpos 3,bx,by,bz 750 modopt 3,0.25,1,0,1 760 moddisp 3 770 call setshadow 780 tilecol 1,0,0,0,128 790 tiledisp 1 800 rem ####################### main 810 label main 820 call ballmove 830 call padmove(1) 840 if mode=2 then call padmove(2) 850 locate 0,0 860 if mode=1 then 870 print "SCORE:";score(1) 880 print " MISS:";miss 890 else 900 print" DOG:";score(1) 910 print" CAT:";score(2) 920 if side=1 then locate 0,0 else locate 0,1 930 print"*" 940 end if 950 if mode=1 and miss>=3 then end 960 if mode=2 and (score(1)>=5 or score(2)>=5) then end 970 fsync 1 980 goto *main 990 rem ################### pad-move 1000 sub padmove(n) 1010 xx=pad(n,14)-127 1020 zz=-pad(n,13)+127 1030 x0=mx(n) 1040 z0=mz(n) 1050 if abs(xx)>20 then 1060 mx(n)=mx(n)+xx/15 1070 if mx(n)<0 then mx(n)=0 1080 if mx(n)>ex then mx(n)=ex 1090 end if 1100 if abs(zz)>20 then 1110 mz(n)=mz(n)+zz/15 1120 if mz(n)>sz then mz(n)=sz 1130 if mz(n)0 or dz<>0 then 1180 modpos n,mx(n),my,mz(n) 1190 if dx=0 then 1200 if dz<0 then md(n)=0 else md(n)=pi 1210 elseif dz=0 then 1220 if dx<0 then md(n)=pi/2 else md(n)=pi*1.5 1230 else 1240 md(n)=atn(dx/dz) 1250 if dz>0 then md(n)=md(n)+pi 1260 end if 1270 modrot n,0,md(n),0 1280 end if 1290 rr=0 1300 a1=pad(n,6) 1310 if a1>20 and a0(n)<=20 then 1320 rr=rg1 1330 vzz=spz1 1340 end if 1350 b1=pad(n,7) 1360 if b1>20 and b0(n)<=20 then 1370 rr=rg1 1380 vzz=spz1*0.8 1390 end if 1400 c1=pad(n,5) 1410 if c1>20 and c0(n)<=20 then 1420 rr=rg2 1430 vzz=spz2 1440 end if 1450 if rr>0 then 1460 dd=sqr((mx(n)-bx)^2+(my-by)^2+(mz(n)-bz)^2) 1470 if dd<=rr and side=n then 1480 if bvz<0 then 1490 ! bvz=-1.02*bvz 1500 bvz=vzz 1510 if mode=1 or side=1 then seplay 34,100,100 else seplay 33,100,100 1520 if mode=1 then score(1)=score(1)+10 else side=3-side 1530 end if 1540 end if 1550 end if 1560 a0(n)=a1 1570 b0(n)=b1 1580 c0(n)=c1 1590 end sub 1600 rem ################# ball-move 1610 sub ballmove 1620 bx=bx+bvx 1630 by=by+bvy 1640 bz=bz+bvz 1650 if bxex-br then 1700 seplay 37,100,100 1710 bx=bx-bvx 1720 bvx=-bvx 1730 end if 1740 if bz>sz-br then 1750 seplay 37,100,100 1760 bz=bz-bvz 1770 bvz=-bvz 1780 elseif bz-br then 1890 seplay 37,100,100 1900 by=by-bvy 1910 bvy=-bvy 1920 end if 1930 bvy=bvy+0.05 1940 modpos 3,bx,by,bz 1950 call setshadow 1960 end sub 1970 rem ##################### shadow 1980 sub setshadow 1990 getspos x1,y1,z1,1,bx-br,-br/2,bz 2000 getspos x2,y2,z2,1,bx+br,br/2,bz 2010 tilepos 1,x1,y1,x2,y2,z1+0.01 2020 end sub