0 votes

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?

in Engine by (12 points)

1 Answer

+1 vote

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.


by (20,917 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.