Scratch for Java

Sprite::goLayersBackwards()

Changes the sprite's layer by the amount.

Examples

import org.openpatch.scratch.*;

public class SpriteGoLayersBackwards {
  public SpriteGoLayersBackwards() {
    Stage myStage = new Stage(600, 240);

    myStage.add(new Sprite("zeta", "assets/zeta_green_badge.png"));
    myStage.add(new Sprite("zeta", "assets/zeta_green_badge.png"));
    myStage.add(new Sprite("zeta", "assets/zeta_green_badge.png"));
    myStage.add(new Sprite("zeta", "assets/zeta_green_badge.png"));
    myStage.add(new Sprite("zeta", "assets/zeta_green_badge.png"));
    Sprite gamma = new Sprite("gamma", "assets/gamma_purple_badge.png");
    gamma.changeX(10);
    myStage.add(gamma);

    myStage.wait(1000);
    gamma.goLayersBackwards(2);
    myStage.wait(1000);
    myStage.exit();
  }

  public static void main(String[] args) {
    new SpriteGoLayersBackwards();
  }
}

View on GitHub

Syntax

Java

.goLayersBackwards(amount)

Scratch

Parameters

NameData TypeDescription
amountintAmout of layers to move backwards.

Return

void