Jump to content

onComplete not triggering


fitness23
 Share

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.

Link to comment
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...
 Share

  • Recently Browsing   0 members

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