First, add a Tween node to your scene. Then something like this might work:
func move(destination):
var _node = self
var _property = "position"
var _initial_value = self.position
var _final_value = destination
var _duration = 1 # in seconds
var _transition_type = Tween.TRANS_LINEAR
var _ease_type = Tween.EASE_IN_OUT
$Tween.interpolate_property(
_node,
_property,
_initial_value,
_final_value,
_duration,
_transition_type,
_ease_type
)
$Tween.start()
(I put the method arguments into variables for clarity, but obviously that might be a bit overkill in your actual code.)
If you need to know when it is finished, you can listen for the tween_completed signal:
func _ready():
$Tween.connect("tween_completed", self, "_your_method_to_handle_move_completed")
func _your_method_to_handle_move_completed():
# do whatever
Thank you very much. I am reading up on tweens now. I will accept your answer once I make it work. In the meanwhile, if you have time, could you have a look at my other question that no one seems to be interested in?