Can someone confirm... the relationship between child/parent and offset & position?

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

If I start with a Sprite, and then instance & add_child() another Sprite, it seems like the following is true:

If you create a tween, and move the parent by property “position” the child will automatically stay “locked” and move with the parent around on screen.

However, if you create a tween, and move the parent by property “offset” the child will stay in it’s original position while the parent moves around on screen.

In my case, the child sprite is a highlighter around the parent sprite representing that the parent sprite is “active”. My current solution is to run 2 tweens at the same time, one that moves the parent sprite’s offset and one that moves the child sprite’s offset in the same manner.

My question is: When you move the offset of a parent node, is it true that the child node does not automatically have it’s offset changed to match that of the parents?

:bust_in_silhouette: Reply From: Magso

No, the child is relative to the transform of the parent. No other settings such as the offset will affect the child nodes.