This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I'm trying to make a Flappy Bird game, where a game manager attached to the scene node creates pipes every second. I also have a base which has a script. I've seen that using raise() noticeably affects performance, so I'm trying to check if the base isn't at the front of the hierachy before using raise(). How would I do this? Is there a built-in function (like get_tree().get_index_in_hierachy(), or do I have to code it myself?

Any help would be greatly appreciated.

in Engine by (19 points)

Could you add a few more details? What does the raise() function do? What is a "base" in this instance?

Just from a documentation point of view, you could probably do:

if(base.get_parent().get_child(0) != base)

Your code worked, thanks!
raise()is a built-in function that raises a node to the top of hierachy (DOCS), but it is pretty intensive.

1 Answer

0 votes
Best answer

Kanor's comment.

if get_parent().get_child(0) != self:
by (19 points)
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 Frequently asked questions and 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 [email protected] with your username.