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

add (sprite)

Parameters

Name Data Type Description
sprite Sprite A reference to a sprite.
text Text A reference to a text.
pen Pen A reference to a pen.

Return

void

add()