Monstamash Posted November 25, 2013 Share Posted November 25, 2013 Hi All I don't know if this is a bug, or my understanding of how it should work, but I would like to call a function at the end of a chained set of tweens. I have the below code, but the function gets called at the end of the first tween, not the end of the last one. Is there a way to call at the end of the last?var tween = game.add.tween(text); tween.to( { x:text.x+10 }, 1000, Phaser.Easing.Linear.None) .to( { x:text.x-20 }, 1000, Phaser.Easing.Linear.None) .to( { x:text.x+20 }, 1000, Phaser.Easing.Linear.None) .to( { x:text.x-20 }, 1000, Phaser.Easing.Linear.None) .to( { x:text.x+10 }, 1000, Phaser.Easing.Linear.None); tween.onComplete.add(sayHello, this); tween.start(); Link to comment Share on other sites More sharing options...
shawnbless Posted November 25, 2013 Share Posted November 25, 2013 Already answered here: http://www.html5gamedevs.com/topic/1651-tween-oncompletecallback/?hl=%2Btween+%2Boncomplete#entry11258 but try this: tween._lastChild.onComplete.add(sayHello, this); Link to comment Share on other sites More sharing options...
Monstamash Posted November 25, 2013 Author Share Posted November 25, 2013 Thanks! shawnbless 1 Link to comment Share on other sites More sharing options...
Recommended Posts