Problems animating object position

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

I’ve created an object as a scene (sprite node). This one has an animation that only makes it change position on the y axis.
The problem is that when instantiating the object in my main scene the animation is done from the point (0,0) … place where I made the animation in the object scene … but I want the animation to be done just at the point where the object was created … how could it do
Data … Use the transform property of the object to animate it

:bust_in_silhouette: Reply From: estebanmolca

The way it is: Do not animate the parent node, animate one of its children so the child moves in relation to the parent. Make sure the child node is at position 0,0 relative to its parent. Then perform the animation on this node.
Example for your instantiate scene:

Node2D //Parent
----Sprite //Animate position here

I was using an Area2D as the parent node and it worked perfectly for it as well.

Pavel 1 | 2020-09-02 14:20

1 Like