0 votes

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:

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.

in Engine by (37 points)

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:

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.

1 Answer

0 votes

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.

by (382 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.