I started to replicate a simple game I`ve made in python. The proccess is underconstruction. I have 3 scene
-a main scene -a gun (a separate scene) -a bullet (a separate scene)
In the main I instantate by script the gun (one time).
I succeded to acces the gun parameters from main by using gun.needed_parameter
The gun has a gdscript that attach a bullet to the main when pressing space using get_parent().add_child(x) where x is a bullet instance
The bullet has a gd script that need some gun size dimensions to position corectly in the scene.
So I thought that once the bullet is instanciated in the main scene (by the gdscript of the gun), I can acces the gun size by looking first at the main scene and than going to the gun like get_parent().gun.size_parameter. But it gives me an error not such index. It seems that i dont`t need the get_parent() part. Si I do not understand. Why I can find the gun parameter directly from inside the bullet using gun.size_parameter. Gun and bullet are on the same level (1) of hierarchy. .. Can you explain me the anomaly?
I think, that you have to call get_parent().get_node("gun").size_parameter from the script within bullet.
get_parent().get_node("gun").size_parameter
If you call get_parent().gun.size_parameter it means that you get a variable name "gun" within the parent_node
get_parent().gun.size_parameter
You are correct. Forgot I defined a gun parameter with full path :)))