Hi, I want to make a shoot 'em up, when I shoot I add the bullet to the shooting point as child, but when the player moves the bullet moves too, how to have the bullet as a child of the shooting point without being affected by the movement of the player? I don't have a lot of stuff already in the projet so I don't think screen or something like that is needed for that post.
Thanks for reading.
#[RESOLVED] I don't want my child node affected by the parent node
25 messages · Page 1 of 1 (latest)
You don’t add it as a child. Have a game manager or another script that listens to a signal on the player, e.g. fire_bullet and then on the signal handler, spawn the bullet somewhere that’s not the player.
A simpler solution is to get the current scene tree and add the bullet there as a child
get_tree().current_scene.add_child(new_bullet)
Ok ! Thanks, so I can just add the bullet as a child of my level and it's works?
I'll try that tomorrow 👍
@versed cliff the bullet does not appears with that
I think I really need to add as child of my firepoint or my player, without that the shoot isn't working
I bet it does, check the remote tab when playing. Likely it isn’t where you expect it to be, but I haven’t seen your script(s) to see how you’re setting the bullets position. You’re on the right track if you set its position to a spawn point or the player position.
When you run the game in the editor, the scene tree window has an extra ‘Remote’ tab that shows what’s happening in the tree when in game. You can see where your bullets are when firing.
I found
They are add same when I don't see them@versed cliff
So they are actually in the scene but I can't see them appear
The photo of the script still shows add_child? Add it to the scene tree instead using the code previously posted.
When I add to the current scene I cannot see them
But they are here
And when I add to the player or the shoot point I see them and obviously they are in the remote tab
@versed cliff
They’re in the wrong position; use %ShootingPoint.global_position when adding to the scene tree.