Scratch for Java

AnimatedSprite::getAnimationFrame()

Gets the current animation frame.

Examples

import org.openpatch.scratch.*;
import org.openpatch.scratch.extensions.animation.*;
 
public class AnimatedSpriteGetAnimationFrame {
  public AnimatedSpriteGetAnimationFrame() {
    Stage myStage = new Stage(600, 240);
    AnimatedSprite bee = new AnimatedSprite();
    bee.addAnimation("idle", "assets/bee_idle.png", 6, 36, 34);
    myStage.add(bee);
    bee.changeY(20);
 
    while (myStage.getTimer().forMillis(5000)) {
      bee.playAnimation("idle");
      bee.say("Frame: " + bee.getAnimationFrame());
    }
    myStage.exit();
  }
 
  public static void main(String[] args) {
    new AnimatedSpriteGetAnimationFrame();
  }
}
 

View on GitHub

Syntax

Java

.getAnimationFrame()

Scratch

(animation frame)

Return

int

getAnimationFrame()