Scratch for Java

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();
  }
}

View on GitHub

Syntax

Java

.addBackdrop(name, filePath)
.addBackdrop(name, filePath, stretch)

Scratch

Parameters

NameData TypeDescription
nameStringName of the backdrop
filePathStringPath to an image file.
stretchbooleanStretch the image to fill the window.

Return

void