leddie Posted December 29, 2014 Share Posted December 29, 2014 I have this chainedTween working fine: followPlayer: function() { //var path is recalculated ... var chainedTween = game.add.tween(this.enemy); for (var i = 1; i < path.length; i++) { chainedTween.to({ x: path[0] * this.tileSize, y: path[1] * this.tileSize }, 400 + Math.random() * 200); } chainedTween.start();} Basically its an enemy following the player. Now I need to "refresh" the tween everytime the player moves. Since the player moves using keyboard keys, the keyboard key isDown event, besides moving the player, also calls the "followPlayer" function. So I added "game.tweens.removeFrom(this.enemy, true);" in order to refresh the tween, but the result was that the enemy don't move while the keyboard key is down, starting to move only when its released. Link to comment Share on other sites More sharing options...
Recommended Posts