window origin "lb" open window 640,512 setup():mystify() sub setup() '====setup arrays for polygons==== dim x(24) dim y(24) dim dirx(24) dim diry(24) '====set initial directions for corners==== for a=1 to 4 read dirx(a) read diry(a) next a for a=5 to 12 dirx(a) = dirx(a-4) diry(a) = diry(a-4) next a for a=13 to 16 read dirx(a) read diry(a) next a for a=17 to 24 dirx(a) = dirx(a-4) diry(a) = diry(a-4) next a '====set initail positions for corners==== for a=1 to 24 read x(a) read y(a) next a '====setup scroll text=== txt$= "Thanks to Adam Lay for provideing the " txt$=txt$+"excelent yabasic.co.uk and Nick Simpson for " txt$=txt$+"provideing the colourful backdrop. Cheers guys" textend=-30-(len(txt$)*10) tx=640 ty=25 end sub sub mystify() repeat clear window draw() '====move the corners==== for a=1 to 24 x(a)=x(a)-dirx(a) y(a)=y(a)-diry(a) '====check for colisions==== if x(a)<100 dirx(a)=0-(dirx(a)) if x(a)>540 dirx(a)=0-(dirx(a)) if y(a)<100 diry(a)=0-(dirx(a)) if y(a)>412 diry(a)=0-(dirx(a)) next a scrolltxt() db() until (peek("port1")=16384) end sub sub draw() cc=cc+0.1 red=50+50*sin(cc/2) blu=50+50*sin(cc/3) grn=50+50*sin(cc/4) setrgb 1,red,30,30 setrgb 2,30,grn,30 setrgb 3,30,30,blu gtriangle 0,0 to 640,512 to 0,512 gtriangle 0,0 to 640,512 to 640,0 clear fill rectangle 75,75 to 562,437 setrgb 1,23,23,23 fill rectangle 100,100 to 540,412 c=c+0.15 setrgb 1,75+50*sin(c/15),75+50*sin(c/17),75+50*sin(c/20) for a=0 to 20 step 4 for b=1 to 3 if a>=12 setrgb 1,75+50*sin((c+75)/10),75+50*sin((c+75)/15),75+50*sin((c+75)/20) line x(b+a),y(b+a) to x((b+1)+a),y((b+1)+a) next b line x(a+1),y(a+1) to x(a+4),y(a+4) next a end sub sub scrolltxt() setrgb 1,75+50*sin(c2/10),75+50*sin(c2/10),75+50*sin(c2/10) c2=c2+0.75 text 100,83,"PRESS 'X' TO QUIT" setrgb 1,250,250,250 text tx,ty,txt$ tx=tx-2 if tx