Sprite::addBackdrop()
Add a backdrop to the stage.
Examples
import org.openpatch.scratch.Stage;
public class StageAddBackdrop {
public StageAddBackdrop() {
Stage myStage = new Stage(600, 240);
myStage.addBackdrop("forest", "assets/background_forest.png", true);
myStage.wait(1000);
myStage.exit();
}
public static void main(String[] args) {
new StageAddBackdrop();
}
}
Syntax
Java
.addBackdrop(name, filePath)
.addBackdrop(name, filePath, stretch)
Scratch
Parameters
Name | Data Type | Description |
---|---|---|
name | String | Name of the backdrop |
filePath | String | Path to an image file. |
stretch | boolean | Stretch the image to fill the window. |
Return
void