'**DODGEBALL version 1.0 -- coded by Demoneye 2002** open window 640,512 setrgb 0,0,0,0 clear screen goto setup label mainloop setdrawbuf d d=1-d setdispbuf d gosub back gosub move gosub moveballs ' check the collision of each ball with ' the player square for ball=1 to numballs xx=xpos(ball) yy=ypos(ball) if xx>x-15 and xxy-15 and yy10 and score<20 speed=5 if score>20 and score<30 speed=6 if score>30 and score<40 speed=7 if score>40 and score<50 speed=8 if score>50 and score<60 speed=9 if score>60 speed=10 goto mainloop label back setrgb 1,50,0,100 setrgb 2,150,0,200 setrgb 3,150,0,200 gtriangle 0,0 to 640,0 to 640,512 gtriangle 0,0 to 0,512 to 640,512 setrgb 1,0,0,0 fill rectangle 60,60 to 580,468 fill rectangle 70,20 to 250,40 setrgb 1,255,255,255 text 70,34,"Your time is: "+str$(score) return label move c=peek("port1") if and(c,16)>0 y=y-7 if and(c,64)>0 y=y+7 if and(c,32)>0 x=x+7 if and(c,128)>0 x=x-7 setrgb 1,100,100,100 fill rectangle x-10,y-10 to x,y fill rectangle x,y to x+10,y+10 setrgb 1,0,0,150 fill rectangle x,y to x+10,y-10 fill rectangle x-10,y+10 to x,y if x<70 x=70 if x>570 x=570 if y<70 y=70 if y>458 y=458 return label moveballs for ball=1 to numballs dir=dir(ball) xpos=xpos(ball) ypos=ypos(ball) if dir=1 then ypos=ypos-speed fi if dir=2 then xpos=xpos+speed ypos=ypos-speed fi if dir=3 then xpos=xpos+speed fi if dir=4 then xpos=xpos+speed ypos=ypos+speed fi if dir=5 then ypos=ypos+speed fi if dir=6 then xpos=xpos-speed ypos=ypos+speed fi if dir=7 then xpos=xpos-speed fi if dir=8 then xpos=xpos-speed ypos=ypos-speed fi if xpos-speed<70 or xpos+speed>570 dir=10-dir if ypos-speed<70 then if dir=1 dir=5 if dir=2 dir=4 if dir=8 dir=6 fi if ypos+speed>468 then if dir=5 dir=1 if dir=6 dir=8 if dir=4 dir=2 fi xpos(ball)=xpos ypos(ball)=ypos dir(ball)=dir setrgb 1,mod(ball,3)*200,mod(ball,2)*200,mod(ball,4)*200 fill circle xpos,ypos,6 next ball return sub ende() close window open window 640,512 setrgb 0,0,0,0 clear screen setrgb 1,255,0,0 text 200,100,"G A M E O V E R" setrgb 1,255,255,0 text 170,220,"You lasted "+str$(score)+" seconds." setrgb 1,255,255,255 if score<=10 then text 150,300,"which is just plain awful." fi if score>=10 and score<20 then text 150,300,"You can do better than that." fi if score>=20 and score<40 then text 140,300,"Getting better. Peraps a bit more practice..." fi if score>=40 and score<80 then text 180,300,"Very impressive." fi if score>80 then text 140,300,"Congratulations, you are a true master." fi setrgb 1,0,255,0 text 170,400,"" repeat pad=peek("port1") until (and(pad,16384)=16384) end sub label setup x=320 y=256 numballs=4 dim xpos(numballs) dim ypos(numballs) dim dir(numballs) for ball=1 to numballs ' make sure no ball starts too close to the player repeat safe=1 xpos(ball)=int(ran(480))+80 ypos(ball)=int(ran(370))+80 if xpos(ball)>280 and xpos(ball)<360 safe=0 if ypos(ball)>216 and ypos(ball)<296 safe=0 until (safe=1) ' make sure all balls are travelling diagonally repeat dir(ball)=int(ran(8)+1) until (mod(dir(ball),2)=0) next ball score=0 speed=4 goto mainloop