GNUton Posted May 10, 2014 Share Posted May 10, 2014 Hi, I would like to know what's the best way to trigger my function with chained tweens.The following code doesn't really work. The function which contains the "alert" is triggered when the first tween completes. var jumpTween = game.add.tween(playState.player); jumpTween.to({ y: 70 }, 200); ju empTween.to({ y: 150}, 400); jumpTween.onComplete.add(function(){console.log("CIAO");}, this); <--- This is triggered when y=70. jumpTween.start(); Is there any elegant solution which doesn't involves combined tweens? (http://examples.phaser.io/_site/view_full.html?d=tweens&f=combined+tweens.js&t=combined%20tweens) Cheers,Antonio Link to comment Share on other sites More sharing options...
Pedro Alpera Posted May 10, 2014 Share Posted May 10, 2014 Look at this topic: http://www.html5gamedevs.com/topic/5819-oncomplete-for-chained-tweens/ GNUton 1 Link to comment Share on other sites More sharing options...
jpdev Posted May 10, 2014 Share Posted May 10, 2014 The linked _lastChild solution works perfectly - but I wish there was official API to do it. @Rich, maybe you could create a getLastTween function that (for now) returns _lastChild? Because anything beginning with underscore is to be considered private and should not be accessed from outside the lib. Link to comment Share on other sites More sharing options...
GNUton Posted May 11, 2014 Author Share Posted May 11, 2014 To me this looks like a bug which should be fixed in the framework.Thanks for your kind answers, guys! Link to comment Share on other sites More sharing options...
Recommended Posts