Scratch for Java

Sprite::getCurrentCostumeName()

Get the name of the current costume.

Examples

import org.openpatch.scratch.*;
 
public class SpriteGetCurrentCostumeName {
  public SpriteGetCurrentCostumeName() {
    Stage myStage = new Stage(600, 240);
    Sprite mySprite = new Sprite("zeta", "assets/zeta_green_badge.png");
    mySprite.addCostume("gamma", "assets/gamma_purple_badge.png");
    myStage.add(mySprite);
 
 
    mySprite.think("Name: " + mySprite.getCurrentCostumeName());
    myStage.wait(2000);
    mySprite.nextCostume();
    mySprite.think("Name: " + mySprite.getCurrentCostumeName());
    myStage.wait(2000);
 
    myStage.exit();
  }
 
  public static void main(String[] args) {
    new SpriteGetCurrentCostumeName();
  }
}
 

View on GitHub

Syntax

Java

.getCurrentCostumeName()

Scratch

costume [name v]

Return

String

getCurrentCostumeName()