0 Members and 1 Guest are viewing this topic.
' Version 2.0' Februar 2001' Made by Einar Wedoe' Programtype: Novell server screensaver look-a-like' Use arrow-keys to change speed and length of tail !Import "bbtype.bmx"Import "bbvkey.bmx"AppTitle ="Novell screensaver"Graphics 800,600,32 ' Sett Grphics modeSetColor 255,0,0 ' Set ColorHideMouse()Global x=400 ' Leader-dot-x-posGlobal y=300 ' Leader-dot-y-posGlobal direction=1 ' Direction variableGlobal directiontmp=0 ' Temporary direction variableGlobal round=10 ' How long between every change of direction ?Global roundcount=0 ' Counter for the roundsGlobal speed#=3 ' SpeedGlobal speedcount=1 ' Counter for speedGlobal length=35 ' Initial tail-lengthGlobal show=0 ' Variable for showing speed and length on screenGlobal tailX[100+1] ' Tail x can be up to 1000 blocks longGlobal tailY[100+1] ' Tail y can be up to 1000 blocks longFor a=1 To 100 ' Set the current tail off the screen tailx(a)=-20 taily(a)=-20NextSeedRnd MilliSecs() ' Make random even more random Global frametimer=CreateTimer(75) ' Set up timer to make everything run nice on all PC's'----------------------------------------- MAIN -----------------------------#start ' MainloopWhile Not VKeyHit(1) ' Loop until ESC is pressed WaitTimer(frametimer) ' Wait.... Cls ' Clean up novell() ' Do stuff changespeedortail() ' Wanna change speed or/and tail ? Flip ' Change bufferWend ' Next round pleaseEnd '----------------------------------------- NOVELL ----------------------------Function novell() ' Start the function to actually put something on the screenspeedcount=speedcount+1 If speed > speedcount Then Goto drawSelect direction ' Moving blocks about Case 1 x=x-11 y=y-13 Case 2 y=y-13 Case 3 y=y-13 x=x+11 Case 4 x=x+11 Case 5 x=x+11 y=y+13 Case 6 y=y+13 Case 7 x=x-11 y=y+13 Case 8 x=x-11 End Selectspeedcount=0border ' Check if we hit the border If direction=100 Then roundcount=round+1 ' If we did, do something about it !directiontest ' Check if time for change of directionFor a=length To 1 Step-1 ' Move the x and y down the line tailx(a+1)=tailx(a) taily(a+1)=taily(a)Nexttailx(1)=x ' Put x in the end of the linetaily(1)=y ' Put y in the end of the line #drawcolordrop=255/length ' Find how much to drop color pr. rectcolortmp=0 ' Set color to 0For a=length To 1 Step -1 ' Draw tail SetColor colortmp,0,0 ' Set color for current rect DrawRect tailx(a),taily(a),10,12 ' Draw current rect colortmp=colortmp+colordrop ' Count up colorNext End Function'----------------------------------------- BORDER ----------------------Function border() ' Set direction to 100 if border is reachedSelect direction Case 1 If x < 15 Or y < 5 Then direction=100 Case 2 If y < 5 Then direction=100 Case 3 If x > 780 Or y < 5 Then direction=100 Case 4 If x > 780 Then direction=100 Case 5 If x > 780 Or y > 585 Then direction=100 Case 6 If y > 585 Then direction=100 Case 7 If x < 15 Or y > 585 Then direction=100 Case 8 If x < 15 Then direction=100End SelectEnd Function'-----------------------------------------Function directiontest() ' Find new direction if it's timeroundcount=roundcount+1 If roundcount > round Then ' Time for a change directiontmp=direction ' Temporary store old direction#findnewdirection direction=Rand(8) ' Find new direction If direction=directiontmp Then Goto findnewdirection ' If it's the same then try again border ' Check for border If direction=100 Then Goto findnewdirection ' Bounce border roundcount=0 ' Reset counter round=Rand(20) ' Set new point for change of direction again EndIf End Function'-----------------------------------------Function changespeedortail() ' Change things If VKeyDown(200) And length < 99 Then ' Add length of tail if arrow-up is pressed length=length+1 ' All length by 1 tailx(length)=-20 ' Set new x-part of tail offscreen taily(length)=-20 ' Set new x-part of tail offscreen show=255 ' Set show variable to print to scren for 200 rasters EndIf If VKeyDown(208) And length > 5 Then ' Decrease length of tail if arrow down is pressed length=length-1 ' Dec by 1 show=255 ' Set show variable to print to scren for 200 rasters EndIf If VKeyDown(203) And speed < 10 Then ' Add speed if arrow-right is pressed speed=speed+0.05 ' Add speed by 0.05 show=255 ' Set show variable to print to scren for 200 rasters EndIf If VKeyDown(205) And speed > 1 Then ' Dec speed if arrow-left is pressed speed=speed-0.05 ' Dec speed by 0.05 show=255 ' Set show variable to print to scren for 200 rasters EndIfshow=show-1 ' Decrease show-variableIf show < 0 Then show=0 ' If show drops below zero keep it on zeroIf show > 0 Then ' If show-variable is activated SetColor show,0,0 ' Fade away text DrawText "Length: "+length,0,0 ' Show length DrawText "Speed: "+Int(10-speed+1),0,12 ' Show speed but since speed is oposite of normal recalculate it EndIf End Function'-----------------------------------------