Tag/Nacht Formel für Spiele mit EntityColor :-)

Übersicht BlitzBasic Codearchiv

Neue Antwort erstellen

Markus2

Betreff: Tag/Nacht Formel für Spiele mit EntityColor :-)

BeitragDo, Jul 01, 2004 23:35
Antworten mit Zitat
Benutzer-Profile anzeigen
EDIT:
Em , schneller ist es wenn man direkt EntityColor benutzt

BlitzBasic: [AUSKLAPPEN]

Local m#
Local w#
Local ft#,fn#
m=120;Int(Mid(CurrentTime(),1,2))*60+Int(Mid(CurrentTime(),4,2)) ;Uhrzeit in Minuten 720 = 12 Uhr , 1440 = 24 Uhr , 0 = 0 Uhr
w=m/8.0
ft=Sin(w) ;Bei Tag 1
fn=1.0-ft ;Bei Nacht 1

DebugLog "Zeit Faktor Tag"+ft
DebugLog "Zeit Faktor Nacht"+fn

Local r#,g#,b#
r=fn*40.0+ft*255.0
g=fn*40.0+ft*240.0
b=fn*80.0+ft*220.0

DebugLog "Farbe RGB="+r+","+g+","+b

If r>255 Then r=255
If g>255 Then g=255
If b>255 Then b=255

For t.TerrainType=Each TerrainType
EntityColor t\Entity,r,g,b
Next

EntityColor eTerrainBorder,r,g,b
EntityColor eHimmel,r,g,b

LightRange light1,10000*fn+300000*ft ;<- 1=1cm

CameraFogColor cam,r/1.3,g/1.3,b/1.3

AmbientLight 50*fn+13*ft,50*fn+13*ft,100*fn+13*ft ;Am Tag 13,13,13



BlitzBasic: [AUSKLAPPEN]

Function EntityColorRec(e,r,g,b)

;MR 04.07.2004

;Entity und alle Child Objekte die Farbe setzen :-)

;Recursive !

If e=0 Then Return

EntityColor e,r,g,b

Local c,i
For i=1 To CountChildren(e)
c=GetChild(e,i)
EntityColorRec c,r,g,b
Next

End Function

Neue Antwort erstellen


Übersicht BlitzBasic Codearchiv

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group