Scratch for Java

Sprite::setTint()

Sets the sprite's tint to the amount.

Examples

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

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

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

View on GitHub

Syntax

Java

.setTint(hue)
.setTint(r, g, b)

Scratch

Parameters

NameData TypeDescription
huefloatA hue value in the range of 0 ... 255
rintA red value in the range of 0 ... 255
gintA green value in the range of 0 ... 255
bintA blue value in the range of 0 ... 255

Return

void