Jump to content

Tween onStart callback problem in Phaser 2.2.1 (works in 2.0.4)


Recommended Posts



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?






Link to comment
Share on other sites

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);
Link to comment
Share on other sites

  • 2 weeks later...

sorry if bump old thread, but i got these problem in 2.2.2 too,

i used trick something like this

this.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

  • 4 weeks later...
  • 2 months later...

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...