How do I smoothly move a Sprite to a certain point?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Kostas Vasileiadis

Hello, I’m having trouble implementing something that sounds simple. So I’ve got a Sprite node that is outside the window and I also got an Area2D somewhere in the scene. When I click on the Area2D the Sprite will slowly move to the Area2D position. I can achieve putting the Sprite instantly to the position of the Area2D but I can’t get it to smoothly move from outside the window to the Area2D position.

Any ideas?

:bust_in_silhouette: Reply From: kidscancode

What you want is “linear interpolation” or lerp().

If you’re not familiar with what this is, you can read this introduction in the docs:

Alternatively, you can use a Tween to move the position.