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

add backdrop (name) (file path)

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

addBackdrop()