Well, what I do when I want to have projectiles in my game is-
1. make the projectiles their own entity/scene.
2. have the shooter spawn the projectile with initial variables
3. give the projectile code to affect other entities in certain ways.
For example, I have a game with a laser cannon in it that the player can collect.
While it's active, the laser cannon creates an instance of the laser. it is given a position among other variable before it is added to the scene. However, to make sure that the laser doesn't move with the player, it is added as a child of the world. In this case it was the player's parent.
The lasers themselves have a script that causes to move across the scene.
They also have an Area2D
that is set up so that whenever another body enters it, in this case an asteroid, it destroys it. The code for destroying the asteroid is in the asteroid itself, but can also be in the laser. It depends on how you want to structure your game logic.
This sort of design works best for ballistic projectiles, such as arrows, fireballs, and cannon balls. If you want a projectile that's more instant and fast moving, like a bullet, then you're better off with a simple raycast.