ZoomBox Posted July 8, 2014 Share Posted July 8, 2014 Hey, I know it's possible to have a delay before a tween start but I would like to know if it's possible to have a delay after the tween ends.The goal is to wait before onComplete(function, args); is fired. Thank you :-) Link to comment Share on other sites More sharing options...
lewster32 Posted July 8, 2014 Share Posted July 8, 2014 The onComplete event always fires at the end of the tween, but it's easy to create a delay within that callback:var tween = game.add.tween(sprite).to({x: 200}, 2000, Phaser.Easing.Quadratic.InOut);tween.onComplete.add(function() { game.time.events.add(1000, function() { // anything here will happen 1 second after the tween has ended }, this);}, this);tween.start();Or of course chain it all together:game.add.tween(sprite).to({x: 200}, 2000, Phaser.Easing.Quadratic.InOut, true).onComplete.add(function() { game.time.events.add(1000, function() { // anything here will happen 1 second after the tween has ended }, this);}, this); Link to comment Share on other sites More sharing options...
ZoomBox Posted July 8, 2014 Author Share Posted July 8, 2014 Haha I feel dumb. I didn't know delayed events were so easy in Phaser. Thank you, it's exactly what I wanted. Link to comment Share on other sites More sharing options...
lewster32 Posted July 8, 2014 Share Posted July 8, 2014 No problem - check out the 'Time' section of the examples page for other things you can do with timed events, such as continual loops and repeated events: http://examples.phaser.io/ ZoomBox 1 Link to comment Share on other sites More sharing options...
Recommended Posts