!include fn_viewer.bas !include graphics gosub uf !fon_l(black) gr.open 255,0,0,0,0,1 gr.screen sw,sh cw=sw/2 : ch=sh/2 !fl(white) gr.color 255,255,255,255,1 tx=text(cw,sh-sh/100,"",sh/50,2,1) !fl(red) gr.color 255,255,0,0,1 gr.circle fly,-10,-10,2 !cl(white,5):a(200) gr.color 255,200,200,200,0 gr.set.stroke 5 gr.circle ufo,0,0,5 !fl(green) gr.color 255,0,255,0,1 gr.rect portal,sw/3,10,sw/3*2,8 x0g=cw y0g=sh x1g=rnd()*sw y1g=0 angle_g=angle(x0g,y0g,x1g,y1g) x=gen_x() y=rnd()*ch v=2 vg=1 do if !fl then gr.touch fl,xtch0,ytch0 gr.touch tchd, xtch1,ytch1 if tchd then xtch=xtch1-xtch0 if xtche<>xtch then x0g=xg : y0g=yg x1g+=xtch/5 angle_g=angle(x0g,y0g,x1g,y1g) tg=0 endif xtche=xtch ytch=ytch0-ytch1 if ytche<>ytch then if ytch>0 & vg<1.5 then vg+=ytch/100000 endif ytche=ytch else fl=0 endif tg+=vg xg=cos(angle_g)*tg+x0g yg=sin(angle_g)*tg+y0g gr.modify ufo,"x",xg,"y",yg x0=x : y0=y x1=xg : y1=yg t=0 angle=angle(x0,y0,x1,y1) if ygy1 then angle=-angle !angle=todegrees(angle) fn.rtn angle fn.end fn.def gen_x() gr.screen w,h a= int(rnd()*2) x=rnd()*w if !a then x=-x if a then x+=w fn.rtn x fn.end fn.def gen_y() gr.screen w,h a= int(rnd()*2) y=rnd()*h if !a then y=-y if a then y+=h fn.rtn y fn.end fn.def crash(ship,x0,y0) dim c[8],x[8],y[8],t[8],v[8] p=pi() gr.color 255, 255,165,0,1 for i=1 to 8 gr.circle c[i], x0,y0,2 v[i]=rnd()*0.5+1 next gr.color 255, 255,165,0,0 gr.set.stroke 1 gr.circle ce,x0,y0,0 te=-4 alpha=255 do alpha-=3 for i=1 to 8 t[i]+=v[i] x[i]=cos(p*2/8*i)*t[i]+x0 y[i]=sin(p*2/8*i)*t[i]+y0 gr.modify c[i],"x",x[i],"y",y[i],"alpha",alpha next te+=0.5 gr.modify ce, "radius", te,"alpha",alpha gr.modify ship,"alpha",alpha gr.render until alpha<3 fn.end fn.def text(x,y,s$,s,ag,av) gr.text.align ag gr.text.size s if av=1 then v=0 if av=2 then v=-(s*(0.29/2))+s/2 if av=3 then v=-(s*0.29)+s gr.text.draw oTx,x,y+v,s$ fn.rtn oTx fn.end return