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

 Share

  • Recently Browsing   0 members

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