Connecting HUD to Main in "Dodge The Creeps" Tutorial - Signal Problem

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

I’m doing the Dodge the Creeps tutorial in the Godot documentation.

In the Connecting HUD to Main section, it says “In the Node tab, connect the HUD’s start_game signal to the new_game() function.”

The “main.gd” script shows as an option to connect to, so I selected that, since the new_game() function is a part of main.gd.

Connecting it makes a new function inside of main.gd:

func _on_HUD_start_game() -> void:
pass # Replace with function body.

So, the part I can’t figure out is, how do I connect it to the other function, new_game, which is also inside of main.gd? new_game is already in there as:

func new_game():
score = 0
$Player.start($StartPosition.position)
$StartTimer.start()

The documentation says “In the Node tab, connect the HUD’s start_game signal to the new_game() function.”, but I can only get as far as placing it in the same main.gd script that new_game is in.

:bust_in_silhouette: Reply From: kidscancode

Type “new_game” in the “Method in Node” box of the connect dialog.

This was demonstrated a few steps earlier when connect the player’s hit signal to game_over():

https://docs.godotengine.org/en/latest/getting_started/step_by_step/your_first_game.html#main-script

Thanks. :slight_smile:

I did that part the other day, so it wasn’t fresh in my memory.

ClaireOdendron | 2019-06-08 18:09