IsLayerVisible
From Spheriki
Returns whether or not the given layer of the current map is visible.
Contents |
Usage
- layer Non-negative integer corresponding to the layer number.
Examples
In this example, the current map has two background layers, with only one visible at a time (imagine a day background and a night background). The day background is on layer number 0, while the night is on background number 1. Normally one would use external variable defined by the player themselves to determine if it is day or night, but in our case, we'll use the IsLayeVisible() function.
function WhatTimeIsIt()
{
if (IsLayerVisible(0) == true && IsLayerVisible(1) == false)
{
return "day";
}
else if (IsLayerVisible(0) == false && IsLayerVisible(1) == true)
{
return "night";
}
else
{
//error, either both day and night layers are visible, or they
//they are both invisible.
}
}
Notes
- This function will only work while the map engine is running.