Stage::getMouseX()
Returns x coordinate of the mouse.
Examples
import org.openpatch.scratch.*;
public class StageGetMouse {
public StageGetMouse() {
Stage myStage = new Stage(600, 240);
while (myStage.getTimer().forMillis(3000)) {
var mouseX = myStage.getMouseX();
var mouseY = myStage.getMouseY();
myStage.display("X: " + mouseX + " Y: " + mouseY);
}
myStage.exit();
}
public static void main(String[] args) {
new StageGetMouse();
}
}
Syntax
Java
.getMouseX()
Scratch
Return
float