dthrasher90 Posted April 21, 2017 Share Posted April 21, 2017 Is there a way to load a spite tween on one button click and then start it with another? I haven't had much success so far Like button 1: tween.add.... whatever button 2 tween. Start() Link to comment Share on other sites More sharing options...
scheffgames Posted April 21, 2017 Share Posted April 21, 2017 The question it's not very clear - you want to start a tween on a button click and then have another tween start after it? If that's the case you should check out chain tweens or combined tweens - the example page on tweens covers lots of scenarios and you should also check out the tween api section. Link to comment Share on other sites More sharing options...
dthrasher90 Posted April 21, 2017 Author Share Posted April 21, 2017 You add the tween on the button. Say the user has four or five different options, he could select one and then execute it Link to comment Share on other sites More sharing options...
AlgoGames Posted April 22, 2017 Share Posted April 22, 2017 7 hours ago, dthrasher90 said: You add the tween on the button. Say the user has four or five different options, he could select one and then execute it You can do something like this on first button click. Notice the last parameter is set to false which ensures tween does not automatically execute. var tween = game.add.tween(sprite).to({ alpha: 0 }, 2000, "Linear", false); In second button click you can simply call tween.start() to start the tween. Link to comment Share on other sites More sharing options...
dthrasher90 Posted April 22, 2017 Author Share Posted April 22, 2017 Ahh cool, didn't think about that Link to comment Share on other sites More sharing options...
Recommended Posts