x and y values are always relative to the container. If your “area” is in a scene and has the position x:50 and y:50, your code will cause the “hitArea” to have x:50 and y:50 relative to the “area”. So it will be x:100 and y:100 in total.
There are 2 solutions:
– Do not set the x and y coordinates of the “hitArea” (or set them to 0), because since it is a child, it will move with the parent if the parent position is changed.
– Do not make the “hitArea” a child of the “area”, but instead put it next to it and then your parent.x and parent.y will work as expected.