Scratch for Java

Sprite::getMouseY()

Returns y coordinate of the mouse.

Examples

import org.openpatch.scratch.*;
 
public class SpriteGetMouse {
  public SpriteGetMouse() {
    Stage myStage = new Stage(600, 240);
    Sprite mySprite = new Sprite("zeta", "assets/zeta_green_badge.png");
    mySprite.changeY(30);
    mySprite.changeX(-100);
    myStage.add(mySprite);
    while (myStage.getTimer().forMillis(3000)) {
      mySprite.say("X: " + mySprite.getMouseX() + " Y: " + mySprite.getMouseY());
    }
    myStage.exit();
  }
 
  public static void main(String[] args) {
    new SpriteGetMouse();
  }
}
 

View on GitHub

Syntax

Java

.getMouseY()

Scratch

(mouse y)

Return

float

getMouseY()