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?

asked Oct 25, 2019 in Engine by Kostas Vasileiadis (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:
https://docs.godotengine.org/en/latest/tutorials/math/interpolation.html

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

https://docs.godotengine.org/en/latest/classes/class_tween.html

answered Oct 25, 2019 by kidscancode (13,384 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.