Scratch for Java

Sprite::move()

Move the sprite x-steps in the current direction.

Examples

import org.openpatch.scratch.*;
 
public class SpriteMove {
  public SpriteMove() {
    Stage myStage = new Stage(600, 240);
    Sprite gamma = new Sprite("gamma", "assets/gamma_purple_badge.png");
    myStage.add(gamma);
    gamma.turnLeft(20);
 
    while (myStage.getTimer().forMillis(3000)) {
      gamma.move(5);
      myStage.wait(100);
    }
    myStage.exit();
  }
 
  public static void main(String[] args) {
    new SpriteMove();
  }
}
 

View on GitHub

Syntax

Java

.move(steps)
.move(vector)

Scratch

move (25) steps

Parameters

Name Data Type Description
steps float Steps to move in the current direction.
vector Vector2 Move in the direction of the vector.

Return

void

move()