Scratch for Java

Stage::getCurrentBackdropIndex()

Get the index of the current backdrop.

Examples

import org.openpatch.scratch.*;
 
public class StageGetCurrentBackdropIndex {
  public StageGetCurrentBackdropIndex() {
    Stage myStage = new Stage(600, 240);
    myStage.addBackdrop("forest", "assets/background_forest.png");
    myStage.addBackdrop("sea", "assets/background_sea.png");
    myStage.display("Index: " + myStage.getCurrentBackdropIndex());
    myStage.wait(2000);
    myStage.nextBackdrop();
    myStage.display("Index: " + myStage.getCurrentBackdropIndex());
    myStage.wait(2000);
    myStage.exit();
  }
 
  public static void main(String[] args) {
    new StageGetCurrentBackdropIndex();
  }
}
 

View on GitHub

Syntax

Java

.getCurrentCostumeIndex()

Scratch

backdrop [number v]

Return

int

getCurrentBackdropIndex()