Tween-position Labels-group relative to their original positions

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

Hi everyone,

I have several Labels in different spots on screen, all members of a group and all sharing a script. There’s a function in that script handling the transparency of all these Labels via Tween („modulate“), so I can have them all together fade in and out as I wish, which works fine.

However, trying to add another Tween („rect_position“) for tweaking their position puts all the Labels into that one position, overlapping each other, which seems like the logical consequence, as they all share the same script.

Is there any way to set a position-tween into that shared script while keeping each Label in their own original spot? I tried around with position: x and global_position but to no avail.

:bust_in_silhouette: Reply From: kurtsev0103

Try setting initial_val as null.

$tween.interpolate_property(some_label, "rect_position", null, new_pos, time)

Thanks for your suggestion.
Setting that “null” is quite interesting, it means, if I understand that right, that the object will move toward the goal-coordinates from wherever it is currently positioned! I didn’t know that.

However, my problem remains, all my Labels mingle together in that one new spot… I wonder if could create a tween like “keep the x-position, only change y”.

EDIT:
Just found a solution:
https://forum.godotengine.org/63604/how-to-tween-the-position-of-a-label-node

pferft | 2021-10-02 18:01

Correct, null means that the start will be at the position where the label is currently positioned.

And to change only the “y” position, write the following:

$tween.interpolate_property(some_label, "rect_position:y", null, new_y, time)

kurtsev0103 | 2021-10-02 22:04

Yes, it’s possible to tweak positions quite flexibly that way.
I, still the beginner, worried I’d have to throw some AnimationPlayer into the mix, but there’s always some elegant solution out there… thanks again!

pferft | 2021-10-03 09:55