Scratch for Java

Sprite::goLayersForwards()

Changes the sprite's layer by the amount.

Examples

import org.openpatch.scratch.*;
 
public class SpriteGoLayersForwards {
  public SpriteGoLayersForwards() {
    Stage myStage = new Stage(600, 240);
 
    Sprite gamma = new Sprite("gamma", "assets/gamma_purple_badge.png");
    gamma.changeX(10);
    myStage.add(gamma);
    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"));
 
    myStage.wait(1000);
    gamma.goLayersForwards(2);
    myStage.wait(1000);
    gamma.goLayersForwards(3);
    myStage.wait(1000);
    myStage.exit();
  }
 
  public static void main(String[] args) {
    new SpriteGoLayersForwards();
  }
}
 

View on GitHub

Syntax

Java

.goLayersBackwards(amount)

Scratch

go [forward v] () layer

Parameters

Name Data Type Description
amount int Amout of layers to move forwards.

Return

void

goLayersForwards()