sync on : hide mouse type __FloodFillType Initialised as integer CoverColour as integer BitmapWidth as integer BitmapHeight as integer endtype global __FloodFillGlobal as __FloodFillType #constant __SpanListSize 15 type __FillSpan Left as integer Right as integer endtype set image colorkey 255,255,0 img = make_arrow() crc = make_circle() set current bitmap 0 color backdrop 0 type xy x as float y as float endtype dim msps(20) as xy for d = 0 to 20 sprite d+2,0,0,img set sprite alpha d+2,250-(d*12) next d ink rgb(255,255,255),0 bx1# = rnd(screen width()) by1# = rnd(screen height()) bx2# = rnd(screen width()) by2# = rnd(screen height()) bx3# = rnd(screen width()) by3# = rnd(screen height()) do rem circles `1 xd1# = msx#-bx1# yd1# = msy#-by1# ang1# = atanfull(xd1#,yd1#) dst1# = sqrt((xd1#^2)+(yd1#^2))*0.005 inc bxm1#,sin(ang1#)*dst1# inc bym1#,cos(ang1#)*dst1# `2 xd2# = msx#-bx2# yd2# = msy#-by2# ang2# = atanfull(xd2#,yd2#) dst2# = sqrt((xd2#^2)+(yd2#^2))*0.005 inc bxm2#,sin(ang2#)*dst2# inc bym2#,cos(ang2#)*dst2# `3 xd3# = msx#-bx3# yd3# = msy#-by3# ang3# = atanfull(xd3#,yd3#) dst3# = sqrt((xd3#^2)+(yd3#^2))*0.005 inc bxm3#,sin(ang3#)*dst3# inc bym3#,cos(ang3#)*dst3# xd12# = bx1#-bx2# yd12# = by1#-by2# dst12# = sqrt((xd12#^2)+(yd12#^2)) if dst12# < 20 bxm1# = (0-bxm1#)+(rnd(4)-2) bym1# = (0-bym1#)+(rnd(4)-2) bxm2# = (0-bxm2#)+(rnd(4)-2) bym2# = (0-bym2#)+(rnd(4)-2) endif xd13# = bx1#-bx3# yd13# = by1#-by3# dst13# = sqrt((xd13#^2)+(yd13#^2)) if dst13# < 20 bxm1# = (0-bxm1#)+(rnd(4)-2) bym1# = (0-bym1#)+(rnd(4)-2) bxm3# = (0-bxm3#)+(rnd(4)-2) bym3# = (0-bym3#)+(rnd(4)-2) endif xd23# = bx2#-bx3# yd23# = by2#-by3# dst23# = sqrt((xd23#^2)+(yd23#^2)) if dst23# < 20 bxm2# = (0-bxm2#)+(rnd(4)-2) bym2# = (0-bym2#)+(rnd(4)-2) bxm3# = (0-bxm3#)+(rnd(4)-2) bym3# = (0-bym3#)+(rnd(4)-2) endif bxm1# = bxm1#*0.99 bym1# = bym1#*0.99 bxm2# = bxm2#*0.99 bym2# = bym2#*0.99 bxm3# = bxm3#*0.99 bym3# = bym3#*0.99 inc bx1#,bxm1# inc by1#,bym1# inc bx2#,bxm2# inc by2#,bym2# inc bx3#,bxm3# inc by3#,bym3# if bx1# < 15 then bxm1# = abs(bxm1#) : bx1# = 15 if by1# < 15 then bym1# = abs(bym1#) : by1# = 15 if bx1# > screen width()-15 then bxm1# = 0-abs(bxm1#) : bx1# = screen width()-15 if by1# > screen height()-15 then bym1# = 0-abs(bym1#) : by1# = screen height()-15 if bx2# < 15 then bxm2# = abs(bxm2#) : bx2# = 15 if by2# < 15 then bym2# = abs(bym2#) : by2# = 15 if bx2# > screen width()-15 then bxm2# = 0-abs(bxm2#) : bx2# = screen width()-15 if by2# > screen height()-15 then bym2# = 0-abs(bym2#) : by2# = screen height()-15 if bx3# < 15 then bxm3# = abs(bxm3#) : bx3# = 15 if by3# < 15 then bym3# = abs(bym3#) : by3# = 15 if bx3# > screen width()-15 then bxm3# = 0-abs(bxm3#) : bx3# = screen width()-15 if by3# > screen height()-15 then bym3# = 0-abs(bym3#) : by3# = screen height()-15 line msx#,msy#,bx1#,by1# line msx#,msy#,bx2#,by2# line msx#,msy#,bx3#,by3# sprite 23,bx1#-15,by1#-15,crc sprite 24,bx2#-15,by2#-15,crc sprite 25,bx3#-15,by3#-15,crc rem curvy mouse movement mmx# = mousemovex() mmy# = mousemovey() circx# = wrapvalue(circx#+(mmx#*2)) circy# = wrapvalue(circy#+(mmy#*2)) ocmx2# = cmx2# ocmy2# = cmy2# cmy2# = cos(circx#)*50 cmx2# = sin(circy#)*50 xmo# = (ocmx2#-cmx2#)+mmx# ymo# = (ocmy2#-cmy2#)+mmy# array insert at top msps(0) array delete element msps(0),21 msps(0).x = msx# msps(0).y = msy# inc msx#,xmo# inc msy#,ymo# while msx# > screen width() : dec msx#,screen width() : endwhile while msx# < 0 : inc msx#,screen width() : endwhile while msy# > screen height() : dec msy#,screen height() : endwhile while msy# < 0 : inc msy#,screen height() : endwhile sprite 1,msx#,msy#,img for d = 0 to 20 sprite d+2,msps(d).x,msps(d).y,img next d sync loop function make_arrow() create bitmap 1,20,20 ink rgb(255,255,0),0 box 0,0,20,20 ink rgb(0,0,255),0 line 0,0,0,10 line 0,0,10,0 line 0,10,3,7 line 10,0,7,3 line 3,7,15,19 line 7,3,19,15 line 15,19,19,15 FloodFill(1,1,rgb(255,0,0)) img = 1 get image img,0,0,19,19 delete bitmap 1 endfunction img function make_circle() create bitmap 1,30,30 ink rgb(255,255,0),0 box 0,0,30,30 for c# = 15 to 0 step -0.5 ink rgb(0,0,255-(c#*17)),0 circle 15,15,c# next c# crc = 2 get image crc,0,0,29,29 delete bitmap 1 endfunction crc ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com global dim __FilledSpans() as __FillSpan global dim __FilledSpansCount() as integer function FloodFill(x,y,c) __FloodFillGlobal.BitmapWidth=bitmap width()-1 __FloodFillGlobal.BitmapHeight=bitmap height()-1 __InitialiseFillSpan() if x >= 0 and x <= __FloodFillGlobal.BitmapWidth if y >= 0 and y <= __FloodFillGlobal.BitmapHeight lock pixels __FloodFillGlobal.CoverColour = point(x,y) if __FloodFillGlobal.CoverColour <> c ink c,0 __FloodLoop(x,y) endif unlock pixels endif endif endfunction function __FloodLoop(x as integer,y as integer) local Left as integer local Right as integer local SpanSize as integer for Left=x-1 to 0 step -1 if point(Left,y) <> __FloodFillGlobal.CoverColour then exit next Left inc Left for Right=x+1 to __FloodFillGlobal.BitmapWidth if point(Right,y) <> __FloodFillGlobal.CoverColour then exit next Right ` draw this line box Left,y,Right,y+1 ` and remember it __AddFillSpan(y,Left-1,Right+1) ` Fill upwards if y > 0 dec y x=Left while x < Right SpanSize=__CheckFillSpan(x,y) if SpanSize = 0 if point(x,y) = __FloodFillGlobal.CoverColour __FloodLoop(x,y) endif inc x else inc x,SpanSize endif endwhile inc y endif ` Fill downwards if y < __FloodFillGlobal.BitmapHeight inc y x=Left while x < Right SpanSize=__CheckFillSpan(x,y) if SpanSize = 0 if point(x,y) = __FloodFillGlobal.CoverColour __FloodLoop(x,y) endif inc x else inc x,SpanSize endif endwhile endif endfunction function __InitialiseFillSpan() local i as integer if __FloodFillGlobal.Initialised = 0 ` First time called, create the arrays - bigger than we should ever need undim __FilledSpans() global dim __FilledSpans(__SpanListSize,2048) as __FillSpan undim __FilledSpansCount() global dim __FilledSpansCount(2048) as integer __FloodFillGlobal.Initialised=1 else ` Subsequent call, just reset the spans we'll be using for i=__FloodFillGlobal.BitmapHeight to 0 step -1 __FilledSpansCount(i)=0 next i endif endfunction function __AddFillSpan(y as integer,Left as integer,Right as integer) local i as integer i=__FilledSpansCount(y) if i < __SpanListSize __FilledSpans(i, y).Left=Left __FilledSpans(i, y).Right=Right inc __FilledSpansCount(y) endif endfunction function __CheckFillSpan(x as integer,y as integer) local i as integer for i=__FilledSpansCount(y)-1 to 0 step -1 if x >= __FilledSpans(i, y).Left if x < __FilledSpans(i, y).Right then exitfunction __FilledSpans(i, y).Right-x endif next i endfunction 0 function XtoY(x#,rad#) newx# = x#/rad# ang# = asin(newx#) newy# = cos(ang#) y# = newy#*rad# endfunction y#