fitness23 Posted July 14, 2017 Share Posted July 14, 2017 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 More sharing options...
Vvalent Posted July 14, 2017 Share Posted July 14, 2017 What you've posted seems to work fine in the sandbox, but without more context its hard to say what the problem might be. If you post a more complete sample of your code I can take a look. Link to comment Share on other sites More sharing options...
snowbillr Posted July 14, 2017 Share Posted July 14, 2017 Are you sure that the `onOnce` call is happening before the tween finishes? Link to comment Share on other sites More sharing options...
Recommended Posts