Use same node in two tweens

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


After a lot of reading and testing i need to make one question.
First thanks to this community and the amazing Godot engine staff.

I am working in a project and i need to use the same container Node inside in two /Curve2D/Pathfollow2D/ Nodes.

My first Tween works fine with this structure, move the elements, emit the signal and change to the second Tween… but in don’t know how to move the Node from the origin to the second /Curve2D/Pathfollow2D/ Node.

Maybe is a stupid program design but i need a clue…
Maybe with move_child? Not my strong point in godot.


extends Node2D

onready var fw1 = get_node("cv_01/fw_01") 
onready var fw2 = get_node("cv_02/fw_02") 
onready var tw1 = get_node("tw1")
onready var tw2 = get_node("tw2") 

func _ready():
	tw1.interpolate_property(fw1, "unit_offset", 0, 1, 4, Tween.TRANS_QUAD, Tween.EASE_OUT)

func _on_tw_tween_all_completed(): 
	tw2.interpolate_property(fw2, "unit_offset", 0, 1, 4, Tween.TRANS_LINEAR, Tween.EASE_IN)

func kill(): 
	if position.y-100 >= get_viewport_rect().size.y: 
		print ("queu_free")
:bust_in_silhouette: Reply From: jgodfrey

So, it sounds like you’re trying to change the parent of the eg node from fw_01 to fw_02? If that’s the case, the general process is:

# get a reference to the eg node
var eg = $cv_01/fw_01/eg


Thanks for your response!
I see, this is the classic option…

But i found the best solution, using RemoteTransform2D.

This is a very specific function to send the move info to a designed Node.
Works like a charm.

—RemoteTransform2D (send move info 1st time)
—RemoteTransform2D (send move info 2nd time)
-eg (receptor 1 and 2 moves)

Naismith | 2020-02-26 20:14

Great - glad you found a satisfactory solution. I only recently became aware of the RemoteTransform2D node too and didn’t think about it for this case. Good to know.

jgodfrey | 2020-02-26 21:27