Projectile moving weird

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

In my game the player has the ability to shoot a projectile but when ever the player moves so does the projectile. How do I fix it

:bust_in_silhouette: Reply From: Abdera7mane

You added the projectile as a child of the player node so when the player moves the projectile position changes accordingly

see this example for instancing nodes using signals:

:bust_in_silhouette: Reply From: timothybrentwood

The projectile moves when your player moves because the projectile is a child of the player. Instead of using add_child() when instancing your projectile use get_parent().add_child().