Instanced Scene as Node doesn't move

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

Hey,
I’ve been following this tutorial: https://www.youtube.com/watch?v=K9m7u0PNfCU&list=PLrwGgU4leWyiZfAMWkLH1GQAYSxySSkeS&index=6&t

And I have this problem and I really need help with it. When I try to instance the enemy scene as a Node I can’t properly move the enemy without leaving the Area2D+Collision behind. I can’t really find any fixes online, even when I try and use the “Make sure the object’s children are not selectable.” option the children are left behind.

For those that didn’t watch the video:
My enemy is a scene composed by:
KinematicBody2D
CollisionPolygon2D
AnimatedSprite
Node
Area2D
CollisionShape2D

I have my main scene and when I instance the enemy scene as a node I’m only able to move the KinematicBody2D (with its sprite and collision) but the Node (Area2D and Collsision) don’t move at all even when I try and use the “Make sure the object’s children are not selectable.” option.

Can you try to improve the question a little so whoever wants to answer does not need to watch the entire video, like adding some screenshots and making clear what your enemy scene composes of, in terms of who is a children or parent, for example:

KinematicBody2D
I–> AnimatedSprite

and so on.

And in general terms, when you move the parent nodes all children nodes are moved/rotated by the same amount, because their position is in relation to their parent. So if your KinematicBody2D is the parent of all other nodes, all the others should accompany it automatically.

tastyshrimp | 2019-12-18 13:39

:bust_in_silhouette: Reply From: i_love_godot

As tastyshrimp mentioned, if you’re using a KinematicBody2D, then everything else needs to be a child of that, otherwise it will be treated as an independent sibling.

If you compare your scene tree to the one in the video, I expect you’ll find that the KinematicBody2D is not the root node. Right click the KinematicBody2D and click “Make scene root”. Now when you move the KinematicBody2D, everything should move with it.