Scratch for Java

Sprite::think()

A thought bubble appears over the sprite and will only go away if the sprite thinks or thinks something else.

Examples

import org.openpatch.scratch.Sprite;
import org.openpatch.scratch.Stage;
 
public class SpriteThink {
  public SpriteThink() {
    Stage myStage = new Stage(600, 240);
    Sprite zeta = new Sprite("green", "assets/zeta_green_badge.png");
    myStage.add(zeta);
    zeta.think("Hi! I'm Zeta and can think line breaks if the line gets too long.");
    myStage.wait(1000);
    myStage.exit();
  }
 
  public static void main(String[] args) {
    new SpriteThink();
  }
}
 

View on GitHub

Syntax

Java

.think(text)
.think(text, milliseconds)

Scratch

think [Hi!] think [Hi!] for (5) seconds

Parameters

Name Data Type Description
text String Text for the speech bubble.
milliseconds int Time for the speech bubble to stay.

Return

void

think()