Puzzle position trouble

I am attempting to make a puzzle game but have hit a little snag in my development. I have the puzzle pieces orientation snap to the player actor by using self.positionX=playerX+((playerl.length-self.position.X)*sin(rotation))) and self.positionY=playerY+((player.width-self.position.Y)*cos(rotation))). But with the player actors length and width at a set XY position the pieces always snap to the same set location. I need the pieces to stay in whatever position they happen to land in and then move with the player actor but I can't use self.position because I need that to change relative to the Player. Please help me out here.