Attention | Topic was automatically imported from the old Question2Answer platform. | |
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
Attention | Topic was automatically imported from the old Question2Answer platform. | |
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
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:
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()
.