Scratch for Java

Stage::add()

Add a sprite, text or pen to the stage

Examples

import org.openpatch.scratch.Sprite;
import org.openpatch.scratch.Stage;

public class StageAdd {
  public StageAdd() {
    Stage myStage = new Stage(600, 240);
    myStage.add(new Sprite("cat", "assets/slime.png"));
    myStage.wait(2000);
    myStage.exit();
  }

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

View on GitHub

Syntax

Java

.add(sprite)
.add(pen)
.add(text)

Scratch

Parameters

NameData TypeDescription
spriteSpriteA reference to a sprite.
textTextA reference to a text.
penPenA reference to a pen.

Return

void