Scratch for Java

Sprite::setY()

Sets the y coordinate of the sprite.

Examples

import org.openpatch.scratch.Sprite;
import org.openpatch.scratch.Stage;
 
public class SpriteSetY {
  public SpriteSetY() {
    Stage myStage = new Stage(600, 240);
    Sprite mySprite = new Sprite("slime", "assets/slime.png");
    myStage.add(mySprite);
    myStage.wait(2000);
    mySprite.setY(20);
    myStage.wait(2000);
    myStage.exit();
  }
 
  public static void main(String[] args) {
    new SpriteSetY();
  }
}
 

View on GitHub

Syntax

Java

.setY(value)

Scratch

set y to ()

Parameters

Name Data Type Description
value float The y coordinate of the sprite.

Return

void

setY()