Hi, i was writing a script to move my player with my mouse/touch input but the problem is the character moves to the mouse position instead of following/copying his movements.
How can i make that the character moves by touch movement and not by its position?
so, if i drag the mouse/touch input slightly to the right the character should move slightly to the right instead of going where the mouse is located, like in this gif.
my current code is:
if event is InputEventScreenDrag:
position.x = lerp(position.x, get_global_mouse_position().x, speed)
position.y = lerp(position.y, get_global_mouse_position().y, speed)
thanks in advance