AnimatedSprite::resetAnimation()
Resets an animation. This is useful for example, when an animation should only be played once, but maybe on a user interaction should play again.
Examples

import org.openpatch.scratch.*;
import org.openpatch.scratch.extensions.animation.*;
public class AnimatedSpriteResetAnimation {
public AnimatedSpriteResetAnimation() {
Stage myStage = new Stage(254, 100);
AnimatedSprite bee = new AnimatedSprite();
bee.addAnimation("idle", "assets/bee_idle.png", 6, 36, 34);
myStage.add(bee);
while (myStage.getTimer().forMillis(4000)) {
bee.playAnimation("idle", true);
if (myStage.isKeyPressed(KeyCode.VK_SPACE)) {
bee.resetAnimation();
}
}
Window.getInstance().exit();
}
public static void main(String[] args) {
new AnimatedSpriteResetAnimation();
}
}
Syntax
Java
.resetAnimation()
Scratch
Return
void