0 votes

I'm making a mobile Space Shooter game and I'm following a tip of GDQuest (Events.gd singleton). It was working well when I had to connect some touch screen buttons to the player functions like move_left move_right stop shoot.

When the player is ready it emits a signal called player_ready in Events.gd and the Controls node (that owns the touch screen buttons) should receive this signal and connect the buttons signals to the player's functions (note that the player is passed in the signal).

But it doesn't work, I know why: when player emits the signal, controls isn't in the tree yet...

How to fix that?

asked Nov 13, 2019 in Engine by JulioYagami (637 points)

1 Answer

+1 vote
Best answer

A scene does not load instantaneously. It is actually a tree that builts node by node when you instance it. Same applies for root scene (main). As you said yourself control is added after player into the tree.

  1. You could rearrange the nodes in the editor.
  2. If that is not an option you can also try adding a delay for player_ready
answered Nov 13, 2019 by Sprowk (328 points)
selected Nov 14, 2019 by JulioYagami
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.