Sets the horizontal mirroring for every sprite in the group.
To mirror the image or animation of a sprite you can either use the Animation tab and create and name each mirror you need, or just use the setMirrorXEach() and setMirrorYEach() commands.
var group = createGroup();
group.add(createSprite(100, 200));
group.add(createSprite(300, 200));
group.setAnimationEach("gnome_1");
function draw() {
background("white");
drawSprites();
if (mouseDown("leftButton")){
group.setMirrorXEach(-1);
}
else {
group.setMirrorXEach(1);
}
}
group.setMirrorXEach(dir)
| Name | Type | Required? | Description |
|---|---|---|---|
| dir | Number | If the parameter is 1, the sprites are displayed normally. If the parameter is -1, the sprites are flipped horizontally. |
No return value. Changes output in the display after drawSprites() is called.
drawSprites() is called.Found a bug in the documentation? Let us know at documentation@code.org