semanser Posted January 1, 2015 Share Posted January 1, 2015 Hi all! I want to do game like Candy Crush (example http://copycut.github.io/gems-swapper/) on Phaser. I use Tweens in Phaser to move all tiles. But I have some problem... I need to recalculate and delete some tiles, only after all tween on the scene are complited. How realize this? Link to comment Share on other sites More sharing options...
spencerTL Posted January 2, 2015 Share Posted January 2, 2015 Could you set a timer to fire after a length of time longer than the longest tween? Eg if all of your Tweens run over 100ms,set a timer to complete after 110ms and run the recalculation/deletions. I think this is the method that gemswap on the phaser examples page uses. Link to comment Share on other sites More sharing options...
semanser Posted January 2, 2015 Author Share Posted January 2, 2015 Thanks. But if i dont know time of all tweens/longer tween? Link to comment Share on other sites More sharing options...
VizuaaLOG Posted January 2, 2015 Share Posted January 2, 2015 Hi all! I want to do game like Candy Crush (example http://copycut.github.io/gems-swapper/) on Phaser. I use Tweens in Phaser to move all tiles. But I have some problem... I need to recalculate and delete some tiles, only after all tween on the scene are complited. How realize this? If you know how many tweens are going to be called you could create two variables, one for the total tweens and one for completed tweens. And then after each tween completes increment that number and check to see if the two variables are the same, if they are then all of your tweens have been completed so you could then run the code or call the function now they have all finished. semanser 1 Link to comment Share on other sites More sharing options...
Recommended Posts