SetLayerVisible
From Spheriki
Sets whether or not the given layer of the current map should be visible.
Contents |
[edit]
Usage
bool SetLayerVisible(layer, bool);
- layer Non-negative integer corresponding to the layer number.
- bool True or false value for the visibility of the layer.
[edit]
Examples
For this example, pressing the Q key will toggle the visibility of layer number 0. This example would most likely be used during debugging.
//in an update script
if (AreKeysLeft())
{
if (GetKey() == KEY_Q)
{
if (IsLayerVisible(0) == true)
SetLayerVisible(0, false);
else
SetLayerVisible(0, true);
//or for condensed code:
//SetLayerVisible(0, !IsLayerVisible(0));
}
}
There are various other examples, but often can include setting the visibility of an overlay layer. For example, a layer can be used for fog in a creepy forest, and when the boss is defeated, that layer's visibility status can be set to false, so there is no more fog in the forest.
[edit]
Notes
- This function will only work while the map engine is running.
- Only tiles are set to be invisible when visibile is set to false. Sprites will remain be visible.
[edit]

