Scratch for Java

Sprite::changeY()

Change the y position by a given amount.

Examples

import org.openpatch.scratch.*;
 
public class SpriteChangeY {
  public SpriteChangeY() {
    Stage myStage = new Stage(600, 240);
    Sprite mySprite = new Sprite("zeta", "assets/zeta_green_badge.png");
    myStage.add(mySprite);
 
    myStage.wait(1000);
    mySprite.changeY(-20);
    myStage.wait(1000);
    mySprite.changeY(40);
    myStage.wait(1000);
 
    myStage.exit();
  }
 
  public static void main(String[] args) {
    new SpriteChangeY();
  }
}
 

View on GitHub

Syntax

Java

.changeY(amount)

Scratch

change y by ()

Parameters

Name Data Type Description
amount float Changes the y position by the amount.

Return

void

changeY()