sprite.mirrorY()
Category:Sprites
Examples
Flipper
Flip the gnome with left and right clicks.
// Flip the gnome with left and right clicks.
var sprite = createSprite(200, 200);
sprite.setAnimation("gnome_1");
function draw() {
background("white");
drawSprites();
if (mouseWentDown("leftButton")) {
sprite.mirrorX(sprite.mirrorX() * -1);
}
if (mouseWentDown("rightButton")) {
sprite.mirrorY(sprite.mirrorY() * -1);
}
}
Syntax
sprite.mirrorY(dir)
Parameters
Name | Type | Required? | Description |
---|---|---|---|
dir | Number | If the parameter is 1, the sprite is displayed normally. If the parameter is -1, the sprite is flipped vertically. If no parameter is given, the function returns the current y mirroring value. |
Returns
If the parameter is given, there is no return value and it changes output in the display after drawSprites() is called. If the parameter is not given, the current mirroring value is returned, 1 or -1.
Found a bug in the documentation? Let us know at support@code.org.