CreateLight()

Syntax

Result = CreateLight(#Light, Color [, x, y, z [, Flags]])
Description
Creates a new #Light of the given color in the current world.

Parameters

#Light A number to identify the light. #PB_Any can be used to auto-generate this number.
Color The color of the new light. Valid colors may be easily created using the RGB() function.
x, y, z (optional) The initial light absolute position. If omitted the light is created at position "0,0,0".
Flags (optional) It can be one of the following value:
  #PB_Light_Point       : Creates a point light (the light is emitted in all directions) (default).
  #PB_Light_Directional : Creates a directional light.
  #PB_Light_Spot        : Creates a spot type light. SpotLightRange() can be used to change the light behavior.

Return value

Nonzero if the light was successfully created, zero otherwise. If #PB_Any was used for the #Light parameter then the generated number is returned on success.

Example

  CreateLight(0, RGB(255,0,0)) ; Creates a red light
  
  CreateLight(1, RGB(0,255,0),  0, 100.7, 50) ; Creates a green light, at the position (0, 100.7, 50)

See Also

FreeLight()

Supported OS

All

<- CopyLight() - Light Index - DisableLightShadows() ->