Stage::find()
Returns a list of all objects of a certain class, which are currently on the stage. It does not matter if they are visible or not.
Examples

import org.openpatch.scratch.Sprite;
import org.openpatch.scratch.Stage;
import org.openpatch.scratch.Window;
import org.openpatch.scratch.extensions.pen.Pen;
public class StageFind {
public StageFind() {
Stage myStage = new Stage(254, 100);
myStage.add(new Pen());
myStage.add(new Pen());
myStage.add(new Sprite());
myStage.display("Sprites: " + myStage.find(Sprite.class).size());
myStage.wait(2000);
Window.getInstance().exit();
}
public static void main(String[] args) {
new StageFind();
}
}
Syntax
Java
.find(class)
Scratch
Parameters
Name | Data Type | Description |
---|---|---|
class | Class | The class of objects you want to find. |
Return
List