frokenstein Posted December 1, 2014 Share Posted December 1, 2014 I am trying to chain tweens then run an onComplete once the final tween runs. Unfortunately Phaser ignores the fist tween. Any ideas why?var tween = this.add.tween(this.alien).to({x: 500, y: 500}, 3000, Phaser.Easing.Linear.None).to({x: 0, y: 0}, 3000, Phaser.Easing.Linear.None).start();tween._lastChild.onComplete.add(function(){this.alien.isAttacking = true;}, this);Once the tween is triggered the sprite goes to x: 0, y: 0 and completely ignores the first directive to go to x: 500, y: 500. I am using Phaser 2.2.0 RC7 and I'm wondering if there is a bug here. Link to comment Share on other sites More sharing options...
eguneys Posted December 1, 2014 Share Posted December 1, 2014 Use Tween.chain to chain tweens so in your case:var tweenUp = this.add.tween(this.alien).to({x: 500, y: 500}, 3000, Phaser.Easing.Linear.None);var tweenZero = this.add.tween(this.alien).to({x: 0, y: 0}, 3000, Phaser.Easing.Linear.None);tweenUp.chain(tweenZero)tweenZero.onComplete.add(function(){ this.alien.isAttacking = true;}, this);tweenUp.start(); frokenstein 1 Link to comment Share on other sites More sharing options...
frokenstein Posted December 4, 2014 Author Share Posted December 4, 2014 Thanks!!! Link to comment Share on other sites More sharing options...
Recommended Posts