Sprite::showVariable()
Shows a monitor for one of this sprite's variables in the top left corner of the stage, like Scratch's variable monitors: "Cat: score" and the current value, updated every frame. Showing the same name again replaces the monitor; it goes away with the sprite.
public Cat() {
this.addCostume("cat", "bunny1_stand");
this.showVariable("lives", () -> lives);
}
Examples
Syntax
Java
.showVariable(name, value)
Scratch
show variable [name v]
Parameters
| Name | Data Type | Description |
|---|---|---|
| name | String | the variable's name, shown after the sprite's |
| value | Supplier<?> | gives the value to show; asked for it every frame |
Return
void