This command creates a new light object.

 olight= New Light(world,position,color,radius,intensity,flag) 



The world in which the light is created.


Not the x, y, z coordinates, but another object on which the light will be situated.


The color of the light using the RGB scale. The color can be controlled with the SetColor command ( please see the following code for an example).


The size of the light.


The intensity of the light, from 0 (darkest) to 255 (brightest). This can be controlled with the SetIntensity command (please see the following code for an example).


Includes these two types:


A moveable light. This is the default setting.


Cannot be moved. These save computation and make your program run faster.


Lights affect only objects that are rendered with Gouraud or Lambert shading. An object made up of a flat color will not be affected.

Sample Code

 oworld = New World(); ocamera = New Camera(oworld); sphere = oworld.CreateSphere(50,50,50,25,25); sphere.SetPosition(0,200,0); // Create a new light at the sphere position. mylight = New Light(oworld,sphere,GetRGB(255,255,0),100,255); mats = New Material(oworld,,RED,"mats"); mats.SetFlat(); sphere.ReplaceMaterial(mats); sphere.SetGouraud; plane = oworld.CreatePlane(600,600); Matplane = New Material(oworld, ,GREEN, "Matplane"); matplane.SetFlat; plane.ReplaceMaterial(matplane); plane.SetAngle(-Pi/2,0,0); plane.SetStatic(); oworld.Optimize(ocamera); ocamera.MoveBack(1200); ocamera.MoveUp(200); sphere.Walk(); // Next line is for true shadow mode. sphere.SetShadowMode(Object.SHADOW_MODE_TRUE); sphere.EnableShadow(); //Loop While(TRUE)  {   //Change the intensity if arrow pressed.   If(IsKeyDown(Keyboard.RIGHT))    {    mylight.SetIntensity(2);    }   //Change the color of the light.       If(IsKeyDown(Keyboard.LEFT))        {    mylight.SetColor(GetRGB(0,0,255));    }   } 

Elementary Game Programming and Simulators Using Jamagic
Elementary Game Programming & Simulations Using Jamagic (Charles River Media Game Development)
ISBN: 1584502614
EAN: 2147483647
Year: 2002
Pages: 105
Authors: Sergio Perez © 2008-2017.
If you may any questions please contact us: