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?






Share this post

Link to post
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 * 2, function(){	tween.start();}, this);

Share this post

Link to post
Share on other sites

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:( - 60) }, 100, Phaser.Easing.Default, true, 1000);setTimeout(function () { console.log('tes');}, 1000); 

or should i use like @pxam ?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.