TGC Codebase Backup



Line screen saver by Alex Libby

19th Dec 2009 19:26
Summary

This is a colorful zigzagging line screen saver.



Description

A fun use of the line command, please credit me!



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    rem Starting the main loop.
RANDOMIZE TIMER()
hide mouse
num=3
white=RGB(255,255,255)
red=RGB(255,0,0)
green=RGB(0,255,0)
blue=RGB(0,0,255)
x1=300
y1=200
x2=300
y2=200
do

rem Random setup.
move=rnd(7)
inkset=rnd(3)

rem Ink setup.
if inkset=0 then color=white
if inkset=1 then color=red
if inkset=2 then color=green
if inkset=3 then color=blue

rem Main loop reset.
if reset=100000
 cls
 RANDOMIZE TIMER()
 reset=0
endif

rem Waiting for random movements.
 if move=0
  yn=-num
 endif

 if move=1
  yn=num
 endif

 if move=2
  xn=-num
 endif

 if move=3
  xn=num
 endif

if move=4
  yn=-num
  xn=-num
 endif

if move=5
  yn=-num
  xn=num
 endif

if move=6
  yn=num
  xn=-num
 endif

if move=7
  yn=num
  xn=num
 endif

rem Adding border limitations.
 if x1<=0
  x2=1
 endif

 if y1<=0
  y2=1
 endif

 if x1=>639
  x2=638
 endif

 if y1=>479
  y2=478
 endif

rem Adding move data to position values.
 x2=x2+xn
 y2=y2+yn

rem resetting move data.
 xn=0
 yn=0

rem Drawing the line.
 ink color,RGB(255,255,255)
 line x1,y1,x2,y2

rem Transferring position values.
 x1=x2
 y1=y2

rem Exit setup
if MOUSECLICK()=1 or MOUSECLICK()=2 or MOUSECLICK()=3 then end
if MOUSEMOVEX()=1 or MOUSEMOVEY()=1 or MOUSEMOVEZ()=1 then end

rem Loop reset
reset=reset+1
loop