Day and Night Cycle


Tweet blitz3d effects tutorials rated
(Posted 1 month ago) RonTek

Simple Day and Night Cycle with AmbientLight

Author: Blitz3DRU

Image

Graphics3D 640,480,16,2
SetBuffer BackBuffer()

Global a=150              ;iden.  +r +g +b
Global inc=-1            ;iden.  a++ or a--
Global r=0               ;red
Global g=0               ;green
Global b=55              ;blue

time=MilliSecs()         ;timer
cam=CreateCamera()       ;camera
l=CreateLight()          ;Light

;--------Ground--------------
p=CreatePlane()
tex=LoadTexture("C:/Blitz3D/samples/mak/castle/environ/terrain-1.jpg")
EntityTexture p, tex
ScaleTexture tex,10,10
PositionEntity p, 0, -1, 0
FreeTexture tex

;----------------------------

;********** Main Loop  ******************
Repeat

tim=MilliSecs()-time   ;Timer 2

;-----------Update color---------------   
If tim/100>1 Then                   
CameraClsColor cam, r+a, g+a, b+a
AmbientLight r+a, g+a, b-55+a
 time=MilliSecs():tim=0
   a=a-inc
   If a=180 Or a=0 Then inc=inc*(-1)
EndIf 
;--------------------------------------

    RenderWorld
    Text 0, 0, "Time: "+tim+" 'A' position "+a
    Flip

Until KeyHit(1)
End 
;*****************************************

Reply To Topic (minimum 10 characters)

Please log in to reply