REM ========================== REM DBC Challenge: Screensaver REM Author: Phaelax REM ========================== randomize timer() REM VARIABLES depth#=400 screenwidth#=800 screenheight#=600 `color as dword color = rgb(205,255,255) newColorDelayAmount = 3000 newColorDelay = 0 total2=40 dim x2#(total2) dim y2#(total2) dim a2#(total2) x2#=rnd(screenwidth#) y2#=rnd(screenheight#) f3=rnd(1) f4=rnd(1) total3=total2 dim x3#(total3) dim y3#(total3) dim a3#(total3) x3#=rnd(screenwidth#) y3#=rnd(screenheight#) f5=rnd(1) f6=rnd(1) REM VARIABLES CALCULATIONS width#=(depth#/10)*16 height#=(depth#/10)*12 even#=screenwidth#/1.6 prop#=depth#/even# REM SETUP set display mode screenwidth#,screenheight#,32 position camera width#/2,height#/-2,0 sync on autocam off hide mouse backdrop on `color backdrop 0 REM OBJECTS for t=1 to total2 make object plain t+100,100,20 color object t+100,rgb(0,0,(total-t)*6) ghost object on t+100 next t for t=1 to total3 make object plain t+200,100,20 color object t+200,rgb(0,(total-t)*6,0) ghost object on t+200 next t sync rate 40 REPEAT a2#(1)=wrapvalue(a2#(1)-4) a3#(1)=wrapvalue(a3#(1)+6) if newColorDelay + newColorDelayAmount < timer() tr = rnd(255) tg = rnd(255) tb = rnd(255) newColorDelay = timer() endif color = getFadedValue(cr,cg,cb,tr,tg,tb) ink color,0 cr = rgbr(color) cg = rgbg(color) cb = rgbb(color) gosub get_new_positions_blue gosub get_new_positions_green for t=1 to total2 position object t+100,x2#(t),y2#(t),depth# ttr=cr-(t-1)*6 ttg=cg-(t-1)*6 ttb=cb-(t-1)*6 if ttr<0 then ttr=0 if ttg<0 then ttg=0 if ttb<0 then ttb=0 color object t+100, rgb(ttr,ttg,ttb) zrotate object t+100, a2#(t) position object t+200,x3#(t),y3#(t),depth# color object t+200, rgb(ttr,ttg,ttb) zrotate object t+200, a3#(t) next t sync until mousemovex() <> 0 or mousemovey() <> 0 end get_new_positions_blue: for t=total2 to 2 step -1 x2#(t)=x2#(t-1) next t for t=total2 to 2 step -1 y2#(t)=y2#(t-1) next t for t=total2 to 2 step -1 a2#(t)=a2#(t-1) next t if f3=1 then inc x2#,9 if f3=0 then dec x2#,9 if x2#>800 then f3=0 if x2#<0 then f3=1 if f4=1 then inc y2#,9 if f4=0 then dec y2#,9 if y2#>600 then f4=0 if y2#<0 then f4=1 x2#(1)=x2#*prop# y2#(1)=y2#*prop#*-1 RETURN get_new_positions_green: for t=total3 to 2 step -1 x3#(t)=x3#(t-1) next t for t=total3 to 2 step -1 y3#(t)=y3#(t-1) next t for t=total3 to 2 step -1 a3#(t)=a3#(t-1) next t if f5=1 then inc x3#,6 if f5=0 then dec x3#,6 if x3#>800 then f5=0 if x3#<0 then f5=1 if f6=1 then inc y3#,6 if f6=0 then dec y3#,6 if y3#>600 then f6=0 if y3#<0 then f6=1 x3#(1)=x3#*prop# y3#(1)=y3#*prop#*-1 RETURN function getFadedValue(currentR,currentG,currentB,targetR, targetG, targetB) as dword if currentR > targetR then dec currentR,1 if currentR < targetR then inc currentR,1 if currentG > targetG then dec currentG,1 if currentG < targetG then inc currentG,1 if currentB > targetB then dec currentB,1 if currentB < targetB then inc currentB,1 color = rgb(currentR, currentB, currentB) endfunction color