TGC Codebase Backup



Daylight System by Samuel

19th Sep 2006 14:51
Summary

Day and night on you game =D



Description

Ok, its a day and light system for thou games =D



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    Rem Make sure you created object 5(sun) and light 1(sun light)
Rem Uh, its saying im anoymus but im Samuel, credit me

Make object cube 1,5
Make object sphere 5,50
Make light 1

do

gosub daynight
control camera using arrowkeys

loop

daynight:
position light 1,object position x(5),object position y(5),object position z(5)
point light 1,object position x(1),object position y(1),object position z(1)
sun=sun +1
xsun#=NEWXVALUE(0, sun, 500)
ysun#=NEWZVALUE(0, sun, 500)
position object 5,xsun# + object position x(1),ysun#+object position y(1),object position z(1)
print ysun#
print sun
set light range 1,sunlight*200
set ambient light sunlight/2
if ysun#<0
 if sunlight>0
  sunlight=sunlight-1
 endif
endif
if ysun#>0
 if sunlight<50
  sunlight=sunlight+1
 endif
endif
return