HUD Issue - Dodge the Creeps

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

So I finished Heads up display — Godot Engine (3.4) documentation in English
and for some reason, the HUD doesn’t work right.
It works, but what it does is show the Get Ready text and the Start button, but the game starts without even clicking Start and Clicking Start does nothing, the HUD still stays on. the score counter works tho.

Here’s the code for

extends Node

export(PackedScene) var mob_scene
var score

func _ready():

func game_over():

func new_game():
	score = 0
	$HUD.show_message("Get Ready!")

func _on_MobTimer_timeout():
	# Create a new instance of the Mob scene.
	var mob = mob_scene.instance()
	# Choose a random location on Path2D.
	var mob_spawn_location = get_node("MobPath/MobSpawnLocation")
	mob_spawn_location.offset = randi()
	# Set the mob's direction perpendicular to the path direction.
	var direction = mob_spawn_location.rotation + PI / 2
	# Set the mob's position to a random location.
	mob.position = mob_spawn_location.position
	# Add some randomness to the direction.
	direction += rand_range(-PI / 4, PI / 4)
	mob.rotation = direction
	# Choose the velocity for the mob.
	var velocity = Vector2(rand_range(150.0, 250.0), 0.0)
	mob.linear_velocity = velocity.rotated(direction)
	# Spawn the mob by adding it to the Main scene.

func _on_ScoreTimer_timeout():
	score += 1

func _on_StartTimer_timeout():

and here’s the code for

extends CanvasLayer

signal start_game

func show_message(text):
	$Message.text = text

func show_game_over():
	show_message("Game Over!")
	# Wait until the MessageTimer has counted down.
	yield($MessageTimer, "timeout")
	$Message.text = "Dodge the\nCreeps!"
	# Make a one-shot timer and wait for it to finish
	yield(get_tree().create_timer(1), "timeout")

func update_score(score):
	$ScoreLabel.text = str(score)

func _on_MessageTimer_timeout():

func _on_StartButton_pressed():


I ran into the same, or at least similar error - I’m using GoDot v3.5.2. Specifically:

E 0:00:02.363   emit_signal: Error calling method from signal 'pressed': 'Node(': Method not found..
  <C++ Source>  core/object.cpp:1242 @ emit_signal() 

I have the start_game signal linked to new_game() as provided in the tutorial. I have triple checked my spelling, capitalization, etc. I’ve even copied and pasted the code from the finished tutorial (available for download) into all 4 .gd files and the error persists.

I’ve included a screen grab of my file with signals: (GoDot-2023-04-25_092724.jpg - Google Drive)

screen grab of the file with signals

I can also either directly share the file or a screen grab if that would help.

Thanks in advance for your assistance! Much appreciated.

mss71gfx | 2023-04-25 13:36

:bust_in_silhouette: Reply From: jgodfrey

It looks like you’ve left the code in an unfinished state. As noted in the Testing the Scene section here

A call to new_game() was added to the main script’s _ready() function just to make sure things were working as expected. Once you’ve verified that, you were supposed to remove that call (again, outlined in the linked section).

Later in the tutorial, the new_game() function is wired to the HUD’s start_game() signal, as outlined here

Fixing those things should get you closer. If you still have things that aren’t working, check the tutorial over closely for similar discrepancies. And, feel free to reach out again if you continue to struggle…