Reputation: 51
this.MyAnimatedSprite.animate(50, 0);
this.MyAnimatedSprite.setVisibility(false);
I am new to AndEngine and I want to animate whole AnimatedSprite once and let it disappear. In my code it only animates and stops but does not disappear, if I do setVisible(false). It does not show animation even once.
Upvotes: 2
Views: 646
Reputation: 748
You can do this by turning the visibility false after the animation is done.
this.MyAnimatedSprite.animate(50, 0, new IAnimationListener () {
@Override
public void onAnimationFinished(AnimatedSprite pAnimatedSprite) {
this.MyAnimatedSprite.setVisibile(false);
}
@Override
public void onAnimationStarted(AnimatedSprite pAnimatedSprite,
int pInitialLoopCount) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationFrameChanged(AnimatedSprite pAnimatedSprite,
int pOldFrameIndex, int pNewFrameIndex) {
// TODO Auto-generated method stub
}
@Override
public void onAnimationLoopFinished(AnimatedSprite pAnimatedSprite,
int pRemainingLoopCount, int pInitialLoopCount) {
// TODO Auto-generated method stub
}});
Upvotes: 2