dthrasher90 Posted April 26, 2017 Share Posted April 26, 2017 Is there a way to disable buttons while a tween is moving, so the user can't hit the button several times and allow for several instances of the tween running at the same time? Link to comment Share on other sites More sharing options...
MikeW Posted April 26, 2017 Share Posted April 26, 2017 use a call back in the tween to unset a flag that you set to say the tween is running. Then check that in button code Umz 1 Link to comment Share on other sites More sharing options...
Umz Posted April 26, 2017 Share Posted April 26, 2017 2 hours ago, MikeW said: use a call back in the tween to unset a flag that you set to say the tween is running. Then check that in button code Just some code to go with this: var tween = this.add.tween(object).to({x:0},duration,Easing,autostart,delay); tween.onStart.add(function() { button.inputEnabled = false; }, context); tween.onComplete.add(function() { button.inputEnabled = true; }, context); And take a look at disabling buttons here : Phaser Examples - Disable button Link to comment Share on other sites More sharing options...
dthrasher90 Posted April 26, 2017 Author Share Posted April 26, 2017 Ahh, gracias, just what I am looking for! Link to comment Share on other sites More sharing options...
MikeW Posted April 26, 2017 Share Posted April 26, 2017 59 minutes ago, Umz said: Just some code to go with this: var tween = this.add.tween(object).to({x:0},duration,Easing,autostart,delay); tween.onStart.add(function() { button.inputEnabled = false; }, context); tween.onComplete.add(function() { button.inputEnabled = true; }, context); And take a look at disabling buttons here : Phaser Examples - Disable button Aha an even better way Link to comment Share on other sites More sharing options...
Recommended Posts