`Grid Screensaver
`07/05/07
`Nick Aldwin aka NinJA999
 
sync on
sync rate 0: CLS 0: Sync
Hide Mouse
 
width = screen width()
height = screen height()
up = 1
col = 0
Rows=2
Columns=2
CellSize=10
 
Do
  If Up = 1
    If col<256
      Inc col
    Else
      up=0
    Endif
  Else
    If col>0
      dec col
    Else
      up=1
    Endif
  Endif
  For Y=0 to Height-34 Step 20
    GridXPos = X+Rnd(10): GridYPos = Y+Rnd(10)
    Grid(GridXPos,GridYPos,Rows,Columns,CellSize,CellSize,RGB(255-col,0,0),RGB(Rnd(col),0,0))
    Get Image 1,GridXPos,GridYPos,GridXPos+(Columns*(CellSize+2))+1,GridYPos+(Rows*(CellSize+2))+1
    For X=0 to Width-34 Step 20
      Paste Image 1,X+Rnd(10),Rnd(height)
    Next X
    X=0
  Next Y
  If scancode()<>0 or mousemovex()<>0 or mousemovey()<>0 or mouseclick()<>0 then end
  sync
loop
 
 
Function Grid(XPosition,YPosition,Columns,Rows,XSize,YSize,CellColourF,CellColourB)
  Ink CellColourB,0
  Box XPosition,YPosition,XPosition+(Columns*(XSize+1)),YPosition+(Rows*(YSize+1))
  Ink CellColourF,0
  For N=0 To Rows
    Line XPosition,  N*(YSize+1)+YPosition,  Columns*(XSize+1)+XPosition,  N*(YSize+1)+YPosition
  Next N
  For N=0 To Columns
    Line N*(XSize+1)+XPosition,  YPosition,  N*(XSize+1)+XPosition,  Rows*(YSize+1)+YPosition
  Next N
Endfunction