SetLayerMask

From Spheriki

Jump to: navigation, search

Sets a tint color for a map layer.


Contents

Usage

SetLayerMask(layer, mask);
  • layer Number, non-negative. The map layer index of the layer to tint.
  • mask Sphere Color object. The colour to tint to.


Examples

Let's create a map of a high-altitude mountain pass. We want the base layer, on which the player can walk, and a lower layer, containing the parallax scrolling of a dark forest, shrouded by mist. We will only concentrate on the mist part for simplicity's sake, and assume the tiles, obstructions and parallax settings have already been handled.

Let layer 0 be the parallax 'mist' layer, and layer 1 be the base layer upon which the player can walk. We place this inside the map's SCRIPT_ON_ENTER_MAP event, using the editor:

var mist_color = CreateColor(192, 192, 255, 128);
SetLayerMask(0, mist_color);

This will create a very flat, simple mist that only tints the lower level, while leaving the upper level clear.


Notes

  • When setting a tint color, be sure that the color has an alpha value less than 255, otherwise the layer will appear completely opaque.
  • In terms of color masking, this uses the color averaging scheme, so a black pixel on a layer with this effect applied may not appear as black after tinting.
  • If tinting is desired for the whole map, considering using the ApplyColorMask() function.


See also

Personal tools