Ketchup_Master Posted November 26, 2018 Share Posted November 26, 2018 I have 4 reusable tweens that should move the target relative to its current position. Each of them is basically the same as this example one, but for each cardinal direction: goLeft = this.tweens.add({ targets: gamePieceSprite, x: {value: '-=64'}, duration: 1000, paused: true }); Since I want to be able to use these tweens multiple times, I use the restart() method, which I want to play the tween from the sprite's current position, but even when I change the position of the sprite, when I call the function to restart the tween it plays from the coordinates at which it first played and not where the targeted sprite currently is. var pathCounter = 0; testPathText.on('pointerdown', function(){ if (pathCounter % 2 == 0) { gamePieceSprite.setX(startTile.x); gamePieceSprite.setY(startTile.y); } else { if (levelStartRotation[level] == '1') { goLeft.restart(); } else if (levelStartRotation[level] == '2') { goUp.restart(); } else if (levelStartRotation[level] == '3') { goDown.restart(); } else if (levelStartRotation[level] == '4') { goRight.restart(); } } pathCounter++; }); Is there any way for me to update the start point of the tween so that restarting it doesn't just start from where it started before? Link to comment Share on other sites More sharing options...
Recommended Posts