Scratch for Java

Sprite::getPen()

Get the pen of the sprite. For more information on what to do with the pen see the documentation of the pen class

Examples

import org.openpatch.scratch.*;

public class SpriteGetPen {
  public SpriteGetPen() {
    Stage myStage = new Stage(600, 240);
    Sprite mySprite = new Sprite("zeta", "assets/zeta_green_badge.png");
    myStage.add(mySprite);
    mySprite.getPen().down();
    while (myStage.getTimer().forMillis(3000)) {
      mySprite.changeX(5);
      myStage.wait(100);
    }
    mySprite.getPen().up();
    myStage.exit();
  }

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

View on GitHub

Syntax

Java

.getPen()

Scratch

Return

Pen