Light Commands

Example

To make a new light: do the following. It is important to make sure that the light you would like to create does not already exist. You will crash if it does.  The following is a point light: Which is just a light at any given point in 3space.

if ( keystate(2) and onLight1 = 0 and shiftkey () = 0 )

make light 1
set point light 1,0,10,0
set light position 1, 0, 10, 0
set light range 1,6000
color light
1,0,0,255
onLight1 = 1;

endif

This will create a light at the position 0, 10, 0. This is optional since the set point light function will position this for you.  As for the color, it can also be set with an RGB value, to insert one, right click and goto color picker in the compiler, or type rgb(rrr,ggg,bbb) in values from 0 to 255. 

A Flashlight: in this example, the light is made with an innercone of 1 degree ( bright light ) and an outer cone of 10 degrees.  This at the moment will point straight down.

if ( keystate(5) and onLight4 = 0 and shiftkey< /FONT > () = 0)

make light 4
set spot light 4,1,10
set light range 4,6000
color light 4, 0,255,255
onLight4 = 1
endif

Now to make the light point in the direction you are looking, you must adjust it so it points to the same place as your player is looking. 

Sunlight: In this example we create light that appears to come from an extremely far off distance.

if ( keystate(6) and onLight5 = 0 and shiftkey () = 0)

make light 5
set Directional light 5,0,10,0
set light range 5,6000
color light 5,255,0,0
onLight5 = 1

endif

This will make a light the GOES in the direction of 0, 10, 0, which would be from straight down to straigt up.

Rotating and Moving Lights:  Most useful with the spotlight.

if ( light exist (4) )

position light 4, posX#, posY#, posZ#
point light 4, playerPointX#, playerPointY#, playerPointZ#
endif

To add a fog to the whole atmosphere is simple.

if ( keyState(33) and fogOn = 0 and shiftkey() = 0)

fog on
fogOn = 1
endif

To Set the distance the fog will block, simply:

if ( keyState(12) and fogOn = 1 )

fogDist = fogdist + 350 * theTime.avgCycleTime#
fog distance fogDist
endif

And finally, to color it, just:

if ( keystate(11) and fogOn = 1)

fog color rnd( 255), rnd( 255), rnd (255)
endif

 

Screens

Download

Example

Downfalls

 

Back To Main