#[RESOLVED] I don't want my child node affected by the parent node

25 messages · Page 1 of 1 (latest)

elfin breach
#

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.

versed cliff
#

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)

elfin breach
#

I'll try that tomorrow 👍

elfin breach
#

@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

versed cliff
elfin breach
#

@versed cliff yeah I do that

#

I don't know what is mean "remote tab"

versed cliff
#

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.

elfin breach
#

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

versed cliff
#

The photo of the script still shows add_child? Add it to the scene tree instead using the code previously posted.

elfin breach
#

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

versed cliff
#

They’re in the wrong position; use %ShootingPoint.global_position when adding to the scene tree.

elfin breach
#

Thanks you so much !

#

Its works now@versed cliff

#

[RESOLVE] I don't want my child node affected by the parent node