lukaMis Posted January 6, 2015 Share Posted January 6, 2015 Hi I am having an issue with Tween onStart callback in Phaser 2.2.1. Callback does not fire at all. If i load Phaser 2.0.4 it works fine. onComplete callback works in both versions. Relevant part of code is:var tween = this.add.tween(instance).to({x: instance.destinationX, y: instance.destinationY}, 2000, Phaser.Easing.Quadratic.InOut, true, randomDelay);tween.onStart.add(this.startFlight, this);tween.onComplete.add(this.stopFlight, this);Any ideas what could the issue be?TnxLuka Link to comment Share on other sites More sharing options...
pxam Posted January 7, 2015 Share Posted January 7, 2015 onStart is dispatched on tween.start() or in your case directly via the autostart parameter before the onStart handler was added.in current versions it's currently more like an 'onTweenStartWithoutDelay' then an 'on(tween)Start' event//create the tween without delayvar tween = this.add.tween(this.sprite).to({x: 100, y: 200}, 2000, Phaser.Easing.Quadratic.InOut, false, 0);//add handlerstween.onStart.add(function(){ console.log('start');}, this);tween.onComplete.add(function(){ console.log('complete');}, this);//delay the tween startthis.time.events.add(Phaser.Timer.SECOND * 2, function(){ tween.start();}, this); Tom Atom 1 Link to comment Share on other sites More sharing options...
Chezt Posted January 20, 2015 Share Posted January 20, 2015 sorry if bump old thread, but i got these problem in 2.2.2 too,i used trick something like thisthis.add.tween(blackjackConfig.player.phaser.CardName[0]).to({ y:520, x:(this.world.width/2 - 60) }, 100, Phaser.Easing.Default, true, 1000);setTimeout(function () { console.log('tes');}, 1000); or should i use like @pxam ? Link to comment Share on other sites More sharing options...
Tom Atom Posted February 16, 2015 Share Posted February 16, 2015 same problem here. I am also using Phaser 2.2.2. onStart() for tweens is called immediately and not after delay as stated in doc. @pxam and @uesugichezt: thanks for solution Link to comment Share on other sites More sharing options...
izimoo Posted April 24, 2015 Share Posted April 24, 2015 It could very well be my bad code, but I am having the same problem in 2.3.http://phaser.io/examples/v2/tweens/tween-loop-event If I edit the onStart function in this example it seems to be ignored. Link to comment Share on other sites More sharing options...
Recommended Posts