+1 vote

Good Day All programmers and the like. I have a seemingly simple yet difficult question. I Just finished making a weapon wheel and long story short a function was used in order to add the gun, it makes an instance that is a child of another node (the fist). Problem is when it adds it to the fist as a child its added at the bottom of the node below the sprite for the fist. Godot apparently uses an orientation as when I use getchild() I have to add a number depending on its orientation E.g $Fist.getchild(0) or $Fist.get_child(5) etc. , the gun node is spawned in as the new child in (The Fist) node and the gun it self is shown over the hands looking awful. Do any of you know if there is anyway to change its orientation Remotely in game. Thank You in Advance

Godot version 3.3.4
in Engine by (27 points)

1 Answer

+2 votes
Best answer

You don't have to change the orientation of childs. You Just need to change the z_index of the Sprites.

Z index. Controls the order in which the nodes render. A node with a higher Z index will display in front of others. Must be between VisualServer.CANVASITEMZ_MIN and VisualServer.CANVASITEMZ_MAX (inclusive).

by (236 points)
selected by

Thank you so much this fixes a lot of problems. There are now so much ways I can implement this.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.