SLUDGE

setLightMap


Syntax:

setLightMap (imageFile);

setLightMap (imageFile, lightMapMode);

Purpose:

Sets a new light-map, loading it from the imageFile file. Each pixel of the light-map corresponds to a pixel of the background image. With a light-map loaded, every character's red, green and blue colour values will be multiplied by the red, green and blue values of the pixel in the imageFile at the corresponding location.

The light-map arithmetic is applied before a character's draw mode (set using the setCharacterDrawMode function) is taken into consideration. This means that light-maps behave as expected even when dealing with transparent characters, but may not give you the results you expect when using FOGGY1 to FOGGY4.

If imageFile is NULL (or anything other than a file handle) the current light-map will be removed. With no light-map loaded, all characters will be drawn at full colour (after any colour changes due to the character's current drawing mode).

If you specify a lightMapMode the current method for applying a light map to characters will be changed. If you don't specify this parameter, the current method for applying a light map will stay the same. The default method is PERPIXEL. Valid values for the lightMapMode parameter are:

PERPIXEL: Each pixel of a character is multiplied by the light map colour in the same position - i.e. one character will have many different colours applied to it in different places. In this mode, the light map is stretched to fill the entire scene, regardless of actual size in pixels. You can keep the lightmaps smaller to save memory and still get good results.

HOTSPOT: Each pixel of a character is multipled by the light map colour at the character's hotspot (base point) - i.e. each character will only have one colour applied to it, determined by where it is currently positioned. In HOTSPOT mode, the imageFile image must be the same width and height as the current scene dimensions, as set by the most recent call to the setSceneDimensions function.

Characters whose extra properties - set using setCharacterExtra - include the NOLIGHTMAP option are not affected by light-maps.

Return value:

No return value.

See also:

addOverlay