Scratch for Java

Sprite::getDirection()

Get the direction of the sprite.

Examples

import org.openpatch.scratch.*;
 
public class SpriteGetDirection {
  public SpriteGetDirection() {
    Stage myStage = new Stage(600, 240);
    Sprite mySprite = new Sprite("zeta", "assets/zeta_green_badge.png");
    myStage.add(mySprite);
    mySprite.changeX(-80);
    mySprite.changeY(30);
    mySprite.setDirection(45);
    mySprite.say("Direction: " + mySprite.getDirection());
    myStage.wait(3000);
    myStage.exit();
  }
 
  public static void main(String[] args) {
    new SpriteGetDirection();
  }
}
 

View on GitHub

Syntax

Java

.getDirection()

Scratch

(direction)

Return

float

getDirection()