Sets the height of the sprite placeholder rectangle for every sprite in the group.
The default height is 100.
var group = createGroup();
group.add(createSprite(100, 200));
group.add(createSprite(300, 200));
function draw() {
background("white");
drawSprites();
if (mouseDown("leftButton")){
group.setHeightEach(20);
}
if (mouseDown("rightButton")){
group.setHeightEach(100);
}
}
group.setHeightEach(height)
| Name | Type | Required? | Description |
|---|---|---|---|
| height | Number | The height of the sprites in pixels. |
No return value. Changes output in the display after drawSprites() is called.
group.setScaleEach to resize a sprite and keep the height to width ratio constant.drawSprites() is called.Found a bug in the documentation? Let us know at documentation@code.org