TGC Codebase Backup



screen savers by Anonymous Coder

16th Aug 2004 9:33
Summary

there are 3 screen savers available one similar with the screen savers of old Microsoft versions



Description

I feel like i'm about to speak the alphabet of alien civilization with very offensive pronounciation, but since i consider it as fundamental and a bit hypothetical of how it could be done something that people were able to do in 1985 with the "virus" game, i'll post it. That ain't virus nor i'm affecting your computer with anything, NOR keeping track of your trails, but if a pop up message appears with a foot on it, that would be so appropriate.
Anyway, you'll realize that it gives the illusion of 3dimensional environment. This can be done with the use of discrete mathematics as well as others. But the trick is when you're about to apply them, a transformation of your screen cordinates, 2d x and y, have to simulate a 3d envirnment. This is done with the help of layers and proper transformation. If anyone knows exactly of how this is done, we would love the help of that person.






Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    global choice$
global color_message_support$

print ""
print "1.Function screen_saver_1()"
print "2.Function screen_saver_2()"
print "3.Function screen_saver_3()"
print ""
print "4.Quit"
print ""
print "Press 'escape' during animated screensaver."
print ""
input "Select screen saver: ",choice$
if (choice$="1")then:screen_saver_1()
if (choice$="2")then:screen_saver_2()
if (choice$="3")
   `print "Color messages support? (yes/no) or (y/n) "
   `input color_message_support$
   screen_saver_3()
endif
end

function screen_saver_2()
global x1,x2,x3,x4,x5,x6,x7,x8
global y1,y2,y3,y4,y5,y6,y7,y8

global x1_direction$="left"
global x2_direction$="left"
global x3_direction$="left"
global x4_direction$="left"
global x5_direction$="left"
global x6_direction$="left"
global x7_direction$="left"
global x8_direction$="left"

global y1_direction$="up"
global y2_direction$="up"
global y3_direction$="up"
global y4_direction$="up"
global y5_direction$="up"
global y6_direction$="up"
global y7_direction$="up"
global y8_direction$="up"

hide mouse

x1=screen width()
y1=screen height()
x2=screen width()
y2=screen height()
x1=rnd(x1)
y1=rnd(y1)
x2=rnd(x2)
y2=rnd(y2)

x3=rnd(x1)
y3=rnd(y1)
x4=rnd(x2)
y4=rnd(y2)

x5=rnd(x1)
y5=rnd(y1)
x6=rnd(x2)
y6=rnd(y2)

x7=rnd(x1)
y7=rnd(y1)
x8=rnd(x2)
y8=rnd(y2)

do

cls
ink rgb(rnd(255),rnd(255),rnd(255)),rgb(0,0,0)
if (x1_direction$="down")
   if (x1<screen width())
      x1=x1+1
   else
      x1_direction$="left"
   endif
endif
if (x1_direction$="left")
   if (x1>0)
      x1=x1-1
   else
      x1_direction$="down"
   endif
endif
```
if (x2_direction$="right")
   if (x2<screen width())
      x2=x2+1
   else
      x2_direction$="left"
   endif
endif
if (x2_direction$="left")
   if (x2>0)
      x2=x2-1
   else
      x2_direction$="right"
   endif
endif
`````
if (x3_direction$="right")
   if (x3<screen width())
      x3=x3+1
   else
      x3_direction$="left"
   endif
endif
if (x3_direction$="left")
   if (x3>0)
      x3=x3-1
   else
      x3_direction$="right"
   endif
endif
`````````
if (x4_direction$="right")
   if (x4<screen width())
      x4=x4+1
   else
      x4_direction$="left"
   endif
endif

if (x4_direction$="left")
   if (x4>0)
      x4=x4-1
   else
      x4_direction$="right"
   endif
endif
``````````
if (x5_direction$="right")
   if (x5<screen width())
      x5=x5+1
   else
      x5_direction$="left"
   endif
endif
if (x5_direction$="left")
   if (x5>0)
      x5=x5-1
   else
      x5_direction$="right"
   endif
endif
`````````
if (x6_direction$="right")
   if (x6<screen width())
      x6=x6+1
   else
      x6_direction$="left"
   endif
endif
if (x6_direction$="left")
   if (x6>0)
      x6=x6-1
   else
      x6_direction$="right"
   endif
endif
`````
if (x7_direction$="right")
   if (x7<screen width())
      x7=x7+1
   else
      x7_direction$="left"
   endif
endif
if (x7_direction$="left")
   if (x7>0)
      x7=x7-1
   else
      x7_direction$="right"
   endif
endif
````
if (x8_direction$="right")
   if (x8<screen width())
      x8=x8+1
   else
      x8_direction$="left"
   endif
endif
if (x8_direction$="left")
   if (x8>0)
      x8=x8-1
   else
      x8_direction$="right"
   endif
endif
`````
if (y1_direction$="down")
   if (y1<screen height())
      y1=y1+1
   else
      y1_direction$="up"
   endif
endif

if (y1_direction$="up")
   if (y1>0)
      y1=y1-1
   else
      y1_direction$="down"
   endif
endif
```
if (y2_direction$="down")
   if (y2<screen height())
      y2=y2+1
   else
      y2_direction$="up"
   endif
endif

if (y2_direction$="up")
   if (y2>0)
      y2=y2-1
   else
      y2_direction$="down"
   endif
endif
`````
if (y3_direction$="down")
   if (y3<screen height())
      y3=y3+1
   else
      y3_direction$="up"
   endif
endif

if (y3_direction$="up")
   if (y3>0)
      y3=y3-1
   else
      y3_direction$="down"
   endif
endif
`````````
if (y4_direction$="down")
   if (y4<screen height())
      y4=y4+1
   else
      y4_direction$="up"
   endif
endif

if (y4_direction$="up")
   if (y4>0)
      y4=y4-1
   else
      y4_direction$="down"
   endif
endif

``````````
if (y5_direction$="down")
   if (y5<screen height())
      y5=y5+1
   else
      y5_direction$="up"
   endif
endif

if (y5_direction$="up")
   if (y5>0)
      y5=y5-1
   else
      y5_direction$="down"
   endif
endif

`````````
if (y6_direction$="down")
   if (y6<screen height())
      y6=y6+1
   else
      y6_direction$="up"
   endif
endif

if (y6_direction$="up")
   if (y6>0)
      y6=y6-1
   else
      y6_direction$="down"
   endif
endif
`````
if (y7_direction$="down")
   if (y7<screen height())
      y7=y7+1
   else
      y7_direction$="up"
   endif
endif

if (y7_direction$="up")
   if (y7>0)
      y7=y7-1
   else
      y7_direction$="down"
   endif
endif
````
if (y8_direction$="down")
   if (y8<screen height())
      y8=y8+1
   else
      y8_direction$="up"
   endif
endif
if (y8_direction$="up")
   if (y8>0)
      y8=y8-1
   else
      y8_direction$="down"
   endif
endif

line x1,y1,x2,y2
line x2,y2,x3,y3
line x3,y3,x4,y4
line x4,y4,x5,y5
line x5,y5,x6,y6
line x6,y6,x7,y7
line x7,y7,x8,y8
loop
endfunction

function screen_saver_1()
global x1
global x2
global y1
global y2

hide mouse
cls
do
ink rgb(rnd(255),rnd(255),rnd(255)),rgb(0,0,0)
x1=screen width()
y1=screen height()
x2=screen width()
y2=screen height()
x1=rnd(x1)
y1=rnd(y1)
x2=rnd(x2)
y2=rnd(y2)
line x1,y1,x2,y2
loop
end
endfunction

function screen_saver_3()

`global color_messages$
global loop_problem_algorithm

global r
global g
global b

global red
global green
global blue

global in_use_red$
global in_use_green$
global in_use_blue$

global in_use_red_now$
global in_use_green_now$
global in_use_blue_now$

global x1,x2,x3,x4,x5,x6,x7,x8
global y1,y2,y3,y4,y5,y6,y7,y8

global x1_direction$="left"
global x2_direction$="left"
global x3_direction$="left"
global x4_direction$="left"
global x5_direction$="left"
global x6_direction$="left"
global x7_direction$="left"
global x8_direction$="left"

global y1_direction$="up"
global y2_direction$="up"
global y3_direction$="up"
global y4_direction$="up"
global y5_direction$="up"
global y6_direction$="up"
global y7_direction$="up"
global y8_direction$="up"

hide mouse

x1=screen width()
y1=screen height()
x2=screen width()
y2=screen height()
x1=rnd(x1)
y1=rnd(y1)
x2=rnd(x2)
y2=rnd(y2)

x3=rnd(x1)
y3=rnd(y1)
x4=rnd(x2)
y4=rnd(y2)

x5=rnd(x1)
y5=rnd(y1)
x6=rnd(x2)
y6=rnd(y2)

x7=rnd(x1)
y7=rnd(y1)
x8=rnd(x2)
y8=rnd(y2)

in_use_red$="yes"
in_use_green$="no"
in_use_blue$="no"


do

cls

`if (color_message_support$="yes" or if color_message_support$="y") then:color_messages()
color_messages()

if (in_use_green$="no")
   if (in_use_blue$="no")
      if (in_use_red$="yes")
         if (red<255)
         red=red+1
         endif
      endif
   endif
endif

if (in_use_green$="no")
   if (in_use_blue$="no")
      if (in_use_red$="yes")
         if (red>255)
            loop_problem_algorithm=1

         endif
      endif
   endif
endif


if (in_use_red$="no")
   if (in_use_blue$="no")
      if (in_use_green$="yes")
         if (green<255)
         `then:in_use_green$="yes":in_use_blue$="no":in_use_red$="no":in_use_green$="yes":green=green+1:red=0:blue=0
         green=green+1
         endif
      endif
   endif
endif

if (in_use_red$="no")
   if (in_use_blue$="no")
      if (in_use_green$="yes")
         if (green>255)
            loop_problem_algorithm=2
         endif
      endif
   endif
endif

if (in_use_red$="no")
   if (in_use_green$="no")
      if (in_use_blue$="yes")
         if (blue<255)
         `then:red=0:green=0:blue=blue+1:in_use_blue$="yes":in_use_red$="no"::in_use_green$="no"
         blue=blue+1
         endif
      endif
   endif
endif

if (in_use_red$="no")
   if (in_use_green$="no")
      if (in_use_blue$="yes")
         if (blue>255)
          `then:red=0:green=0:blue=0:in_use_blue$="no":in_use_red$="yes":in_use_green$="no"
         loop_problem_algorithm=3
         endif
      endif
   endif
endif


if (loop_problem_algorithm=1) then:do_algorithm(1)
if (loop_problem_algorithm=2) then:do_algorithm(2)
if (loop_problem_algorithm=3) then:do_algorithm(3)



ink rgb(red,green,blue), rgb(0,0,0)

if (x1_direction$="down")
   if (x1<screen width())
      x1=x1+1
   else
      x1_direction$="left"
   endif
endif
if (x1_direction$="left")
   if (x1>0)
      x1=x1-1
   else
      x1_direction$="down"
   endif
endif
```
if (x2_direction$="right")
   if (x2<screen width())
      x2=x2+1
   else
      x2_direction$="left"
   endif
endif
if (x2_direction$="left")
   if (x2>0)
      x2=x2-1
   else
      x2_direction$="right"
   endif
endif
`````
if (x3_direction$="right")
   if (x3<screen width())
      x3=x3+1
   else
      x3_direction$="left"
   endif
endif
if (x3_direction$="left")
   if (x3>0)
      x3=x3-1
   else
      x3_direction$="right"
   endif
endif
`````````
if (x4_direction$="right")
   if (x4<screen width())
      x4=x4+1
   else
      x4_direction$="left"
   endif
endif

if (x4_direction$="left")
   if (x4>0)
      x4=x4-1
   else
      x4_direction$="right"
   endif
endif
``````````
if (x5_direction$="right")
   if (x5<screen width())
      x5=x5+1
   else
      x5_direction$="left"
   endif
endif
if (x5_direction$="left")
   if (x5>0)
      x5=x5-1
   else
      x5_direction$="right"
   endif
endif
`````````
if (x6_direction$="right")
   if (x6<screen width())
      x6=x6+1
   else
      x6_direction$="left"
   endif
endif
if (x6_direction$="left")
   if (x6>0)
      x6=x6-1
   else
      x6_direction$="right"
   endif
endif
`````
if (x7_direction$="right")
   if (x7<screen width())
      x7=x7+1
   else
      x7_direction$="left"
   endif
endif
if (x7_direction$="left")
   if (x7>0)
      x7=x7-1
   else
      x7_direction$="right"
   endif
endif
````
if (x8_direction$="right")
   if (x8<screen width())
      x8=x8+1
   else
      x8_direction$="left"
   endif
endif
if (x8_direction$="left")
   if (x8>0)
      x8=x8-1
   else
      x8_direction$="right"
   endif
endif
`````
if (y1_direction$="down")
   if (y1<screen height())
      y1=y1+1
   else
      y1_direction$="up"
   endif
endif

if (y1_direction$="up")
   if (y1>0)
      y1=y1-1
   else
      y1_direction$="down"
   endif
endif
```
if (y2_direction$="down")
   if (y2<screen height())
      y2=y2+1
   else
      y2_direction$="up"
   endif
endif

if (y2_direction$="up")
   if (y2>0)
      y2=y2-1
   else
      y2_direction$="down"
   endif
endif
`````
if (y3_direction$="down")
   if (y3<screen height())
      y3=y3+1
   else
      y3_direction$="up"
   endif
endif

if (y3_direction$="up")
   if (y3>0)
      y3=y3-1
   else
      y3_direction$="down"
   endif
endif
`````````
if (y4_direction$="down")
   if (y4<screen height())
      y4=y4+1
   else
      y4_direction$="up"
   endif
endif

if (y4_direction$="up")
   if (y4>0)
      y4=y4-1
   else
      y4_direction$="down"
   endif
endif

``````````
if (y5_direction$="down")
   if (y5<screen height())
      y5=y5+1
   else
      y5_direction$="up"
   endif
endif

if (y5_direction$="up")
   if (y5>0)
      y5=y5-1
   else
      y5_direction$="down"
   endif
endif

`````````
if (y6_direction$="down")
   if (y6<screen height())
      y6=y6+1
   else
      y6_direction$="up"
   endif
endif

if (y6_direction$="up")
   if (y6>0)
      y6=y6-1
   else
      y6_direction$="down"
   endif
endif
`````
if (y7_direction$="down")
   if (y7<screen height())
      y7=y7+1
   else
      y7_direction$="up"
   endif
endif

if (y7_direction$="up")
   if (y7>0)
      y7=y7-1
   else
      y7_direction$="down"
   endif
endif
````
if (y8_direction$="down")
   if (y8<screen height())
      y8=y8+1
   else
      y8_direction$="up"
   endif
endif
if (y8_direction$="up")
   if (y8>0)
      y8=y8-1
   else
      y8_direction$="down"
   endif
endif

````````
line x1,y1,x2,y2
line x2,y2,x3,y3
line x3,y3,x4,y4
line x4,y4,x5,y5
line x5,y5,x6,y6
line x6,y6,x7,y7
line x7,y7,x8,y8
line x8,y8,x1,y1
`````````
line x1,y1,x3,y3
line x2,y2,x3,y3
line x4,y4,x3,y3
line x5,y5,x3,y3
line x6,y6,x3,y3
line x7,y7,x3,y3
line x8,y8,x3,y3
`````
line x1,y1,x4,y4
line x2,y2,x4,y4
line x3,y3,x4,y4
line x5,y5,x4,y4
line x6,y6,x4,y4
line x7,y7,x4,y4
line x8,y8,x4,y4
``````
line x1,y1,x5,y5
line x2,y2,x5,y5
line x3,y3,x5,y5
line x4,y4,x5,y5
line x6,y6,x5,y5
line x7,y7,x5,y5
line x8,y8,x5,y5
```````
line x1,y1,x6,y6
line x2,y2,x6,y6
line x3,y3,x6,y6
line x4,y4,x6,y6
line x5,y5,x6,y6
line x7,y7,x6,y6
line x8,y8,x6,y6
`````
line x1,y1,x7,y7
line x2,y2,x7,y7
line x3,y3,x7,y7
line x4,y4,x7,y7
line x5,y5,x7,y7
line x6,y6,x7,y7
line x8,y8,x7,y7
`````````
line x1,y1,x8,y8
line x2,y2,x8,y8
line x3,y3,x8,y8
line x4,y4,x8,y8
line x5,y5,x8,y8
line x6,y6,x8,y8
line x7,y7,x8,y8
`````````
loop
endfunction


function color_messages()
set cursor 10,10
print "In use red  : ",in_use_red$
set cursor 160,10
print red
set cursor 10,25
print "In use green: ",in_use_green$
set cursor 160,25
print green
set cursor 10,40
print "In use blue : ",in_use_blue$
set cursor 160,40
print blue
endfunction


function step_color(r$,g$,b$)
if (r$="yes" and g$="no"  and b$="no") then:r=0:g=1:b=0
if (r$="no"  and g$="yes" and b$="no") then:r=1:g=1:b=0
if (r$="yes" and g$="yes" and b$="no") then:r=0:g=0:b=1
if (r$="no"  and g$="no"  and b$="yes")then:r=1:g=0:b=1
if (r$="yes" and g$="no"  and b$="yes")then:r=0:g=1:b=1
if (r$="no"  and g$="yes" and b$="yes")then:r=1:g=1:b=1
if (r$="yes" and g$="yes" and b$="yes")then:r=1:g=0:b=0

if (r=1 and g=0 and b=0)
   in_use_red_now$="yes"
   in_use_green_now$="no"
   in_use_blue_now$="no"
endif
if (r=0 and g=1 and b=0)
   in_use_red_now$="no"
   in_use_green_now$="yes"
   in_use_blue_now$="no"
endif
if (r=1 and g=1 and b=0)
   in_use_red_now$="yes"
   in_use_green_now$="yes"
   in_use_blue_now$="no"
endif
if (r=0 and g=0 and b=1)
   in_use_red_now$="no"
   in_use_green_now$="no"
   in_use_blue_now$="yes"
endif
if (r=1 and g=0 and b=1)
   in_use_red_now$="yes"
   in_use_green_now$="no"
   in_use_blue_now$="yes"
endif
if (r=0 and g=1 and b=1)
   in_use_red_now$="no"
   in_use_green_now$="yes"
   in_use_blue_now$="yes"
endif
if (r=1 and g=1 and b=1)
   in_use_red_now$="yes"
   in_use_green_now$="yes"
   in_use_blue_now$="yes"
endif
endfunction







function initialize_colors()
red=0
green=0
blue=0
endfunction

function in_use_now()
if (in_use_green_now$="no")
   if (in_use_blue_now$="no")
      if (in_use_red_now$="yes")
         red=red+1
      endif
   endif
endif

if (in_use_green_now$="yes")
   if (in_use_blue_now$="no")
      if (in_use_red_now$="no")
         green=green+1
      endif
   endif
endif

if (in_use_green_now$="no")
   if (in_use_blue_now$="yes")
      if (in_use_red_now$="no")
         blue=blue+1
      endif
   endif
endif
endfunction

function do_algorithm(algorithm)
if (algorithm=1)
   step_color("yes","no","no")
   initialize_colors()
   in_use_now()
endif

if (algorithm=2)
   step_color("no","yes","no")
   initialize_colors()
   in_use_now()
endif

if (algorithm=3)
   step_color("no","no","yes")
   initialize_colors()
   in_use_now()
endif

endfunction