How to connect a signal to a function?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Donnie Stockman

I know, this might be a stupid question, but I’m pretty new to creating games. Especially on the Godot Engine.

So, the problem is: I was following the Godot Docs instruction for newbies and got to the “Creating your first game” section. Everything was good until there was no explanation to one thing - “How to connect a signal to a function”. I tried to do it, but didn’t understand how. There’s no useful information on that topic in the Internet. I even tried to connect them through code in several ways, but still there is no result.

I really hope you can help me with that!

:bust_in_silhouette: Reply From: kidscancode

In the “Dodge the Creeps” tutorial, when you are first asked to connect a signal, in this section, it is explained how to do so using the “Node” tab in the editor.

In addition, there is an entire page dedicated to explaining signals here:

This page walks you through several examples.

There are quite a few other sections of the docs that discuss and/or give examples of signal usage, such as the UI section, where signals are used to update UI elements on such as healthbars and score counters.

:bust_in_silhouette: Reply From: Frishkorn

I know that it has been over a year and I hope that you haven’t given up.

I too was following this tutorial and at first, I was confused by this very step. But all you need to do is select the HUD node from the Main scene, select the Nodes tab, click Signals, click the start_game() signal, hit Connect, and once the Connect Signal dialog opens simply type in new_game in the Method In Node input box.

It’s no wonder why people give up on learning programming. Rather than getting actual help, people point you to not always clear documentation.

While this comment is well over 2 years old at this point, I got stuck here as well. Just wanted to say thank you for the clear information.

raunchers | 2023-03-29 21:43