group.setVisibleEach()
Category:Groups
Sets the visibility for every sprite in the group.
The default visibility is true.
Examples
var group = createGroup();
group.add(createSprite(100, 200));
group.add(createSprite(300, 200));
function draw() {
background("white");
drawSprites();
if (mouseDown("leftButton")){
group.setVisibleEach(true);
}
else {
group.setVisibleEach(false);
}
}
Syntax
group.setVisibleEach(bool)
Parameters
Name | Type | Required? | Description |
---|---|---|---|
bool | Boolean | The visibility of the group of sprites, true or false. |
Returns
No return value. Changes output in the display after drawSprites() is called.
Tips
- A sprite that is not visible can still collide with other sprites and user mouse interactions.
- Groups of sprites all have the same functions and you use the dot notation (combining the name of the group, followed by a dot, with the function name) to call the function for that group of sprites.
- Any changes to the properties of a sprite will not be seen until after
drawSprites()
is called.
Found a bug in the documentation? Let us know at support@code.org.