Sprite::whenClicked() Examples Syntax Java Scratch Return Sprite::whenClicked() This method is called when the sprite is clicked. Examples import org.openpatch.scratch.Sprite; import org.openpatch.scratch.Stage; public class SpriteWhenClicked { class CustomSprite extends Sprite { public CustomSprite() { this.addCostume("zeta", "assets/zeta_green_badge.png"); this.addCostume("gamma", "assets/gamma_purple_badge.png"); } @Override public void whenClicked() { this.nextCostume(); } } public SpriteWhenClicked() { Stage myStage = new Stage(600, 240); myStage.add(new CustomSprite()); while (myStage.getTimer().forMillis(3000)) ; myStage.exit(); } public static void main(String[] args) { new SpriteWhenClicked(); } } View on GitHub Syntax Java void whenClicked() Scratch when this sprite clicked Return void whenClicked()