lukaMis

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

Recommended Posts

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?

Tnx

Luka

 

 

 

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 startthis.time.events.add(Phaser.Timer.SECOND * 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:(this.world.width/2 - 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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.