This is a basic Day/Night cycle I'm working on. It's being tweaked a little, but it's pretty decent now.
Day/Night cycles are important parts of games nowadays, so it's important to have one to make your game to the standard.
If you can tweak it, feel free to post any improvements, as it's merely decent as of now.
sync on : sync rate 60
set display mode 1024,768,32
make object cube 1,1 `Dummy object so we can view effects of lighting and backdrop
SkyChange=4 `How fast the day/night cycles. Larger values increase the cycle length.
do `Initialize our loop
gosub SkyCycle `Go to our gosub
sync `Refresh the screen
loop `Loop our loop
SkyCycle: `Here's our gosub
DayNight=DayNight+1
if DayNight=SkyChange `Basically, when DayNight= our Skychange variable, it's updated.
if Darken>199 then Add=0 `These two lines tell us whether to darken or lighten the sky.
if Darken<1 then Add=1
If Add=1 then Darken=Darken+1 `If we need more light add it.
If Add=0 then Darken=Darken-1 `If we need less light, take it away
set ambient light Darken `Increase or decrease the scene lighting
`These next two parts are where the sky actually changes color.
`The backdrop won't effect objects, but the ambient lights will.
if Add=1
COLOR BACKDROP rgb(0,0,55+Darken)
color ambient light rgb(55+Darken,55+Darken,55+Darken)
else
COLOR BACKDROP rgb(55,55,55+Darken)
color ambient light rgb(55+Darken,55+Darken,55+Darken)
endif
DayNight=0
endif
Return
`Feel free to tweak this command as you like.
`:)
A book? I hate book. Book is stupid.
(Formerly known as Yellow)
