fitness23

onComplete not triggering

Recommended Posts

So I'm trying to create a tween within my sprite called "walkingTween".

enemy.walkingTween = this.game.add.tween(enemy).to({ x: this.player.x, y: this.player.y }, walkSpeedTime, Phaser.Easing.none).start();

And this successfully makes the tween happen.

However when I try to make it do something after the tween, onComplete doesn't trigger off.

enemy.walkingTween.onComplete.addOnce(function () {

                    console.log("Tween Complete!");
                }, this);

Any ideas?

 

If I did a normal tween such as:

var enemyWalk = this.game.add.tween(enemy).to({ x: this.player.x, y: this.player.y }, walkSpeedTime, Phaser.Easing.none).start();

Then the onComplete function DOES work. But for various reasons I have to have this tween assigned under the sprite itself.

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.