quiphop Posted June 17, 2016 Share Posted June 17, 2016 Hi everyone. I'm stucked at tweens. So, i have yoyo tween. In first, i want to check that yoyo has reached it "middle" (before/on loop back), is there any way to check that? The second question: at the docs we can see Quote A tween that yoyos will reverse itself and play backwards automatically. A yoyo'd tween doesn't fire the Tween.onComplete event, so listen for Tween.onLoop instead But, in my case the both methods will be called. Am i doing something wrong? Here is my code : this.p2AttackAnim = this.game.add.tween(this.p2).to({ x: 300 }, 500, Phaser.Easing.Bounce.Out, false, 0,0, true); this.p2AttackAnim.onStart.addOnce(function(){ this.p2.frame = 2; }, this); this.p2AttackAnim.onComplete.addOnce(function(){ this.p2.frame = 0; this.p1.frame = 1; }, this); this.p2AttackAnim.onLoop.addOnce(function(){ this.p1.frame = 1; }, this); Link to comment Share on other sites More sharing options...
quiphop Posted June 19, 2016 Author Share Posted June 19, 2016 I had updated phaser from 2.4.4 to 2.5.0. Everything seems working for now. Link to comment Share on other sites More sharing options...
Recommended Posts