Nitesh Posted May 12, 2017 Share Posted May 12, 2017 I am making winning animation to play at the time when player wins. this.mainAnimationObj.play(50, false, false); This is playing the animation for only one time. I want to play this for 3-4 times, and after final animation, it should destroy. I am doing like below: private showWinnerAnimation() { this.mainAnimationObj.play(50, false, false); this.mainAnimationObj.onComplete.addOnce(this.onOneAnimationComplete, this); } private onOneAnimationComplete() { this.mainAnimationObj.play(50, false, false); this.mainAnimationObj.onComplete.addOnce(this.onTwoAnimationComplete, this); } private onTwoAnimationComplete() { this.mainAnimationObj.play(50, false, false); this.mainAnimationObj.onComplete.addOnce(this.onThreeAnimationComplete, this); } private onThreeAnimationComplete() { this.mainAnimationObj.play(50, false, true); } This plays animation for three times. But the problem is that for the next game, the animation does not play at all (I think it's because the animation is not being destroyed for the first time). Can you please help me. Link to comment Share on other sites More sharing options...
RubbleGames Posted May 13, 2017 Share Posted May 13, 2017 Work out how long the animation takes, then set it to repeat and use a timer to destroy it after it's had long enough to play 3-4 times. Link to comment Share on other sites More sharing options...
Recommended Posts