Scratch for Java

AnimatedSprite::isAnimationPlayed()

Returns true if the animation is fully played. This only works, when the animation is played once.

Examples

import org.openpatch.scratch.*;
import org.openpatch.scratch.extensions.animation.*;

public class AnimatedSpriteIsAnimationPlayed {
  public AnimatedSpriteIsAnimationPlayed() {
    Stage myStage = new Stage(600, 240);
    AnimatedSprite bee = new AnimatedSprite();
    bee.addAnimation("idle", "assets/bee_idle.png", 6, 36, 34);
    myStage.add(bee);

    while (true) {
      bee.playAnimation("idle", true);
      if (bee.isAnimationPlayed()) {
        break;
      }
    }
    myStage.exit();
  }

  public static void main(String[] args) {
    new AnimatedSpriteIsAnimationPlayed();
  }
}

View on GitHub

Syntax

Java

.isAnimationPlayed()

Scratch

Return

boolean