I am trying to animating the player on a line the player draws. Right now the player is animating at the beginning and end of the line but not while he is moving on the line. This is the code for movingOnLine
function movePlayerOnLine(event)
–for the original image replace all rich with player.
if posCount ~= linePart then
richDir = math.atan2(ractgangle_hit[posCount].y-rich.y,ractgangle_hit[posCount].x-rich.x)*180/math.pi
playerSpeed = 5
rich.x = rich.x + math.cos(richDir*math.pi/180)*playerSpeed
rich.y = rich.y + math.sin(richDir*math.pi/180)*playerSpeed
if rich.x < ractgangle_hit[posCount].x+playerSpeed*10 and rich.x > ractgangle_hit[posCount].x-playerSpeed*10 then
if rich.y < ractgangle_hit[posCount].y+playerSpeed*10 and rich.y > ractgangle_hit[posCount].y-playerSpeed*10 then
rich:prepare(“rich”)
rich:play()
posCount = posCount + 1
end
end [import]uid: 94237 topic_id: 17065 reply_id: 317065[/import]