#Signal not being emitted

1 messages · Page 1 of 1 (latest)

modest wren
#

Hi all. I'm working on the "Your first 2D game" tutorial from the Godot Docs > Getting Started, and something breaking down with my game's Start button.

When I press the start button, the button disappears, but the game doesn't start.

_on_start_button_pressed (in the HUD node's script) and new_game (in main.gd) are connected. (screenshot attached)

  • Tried disconnecting and reconnecting, but no change.
  • new_game triggers fine if I have _ready call it.
  • I'm seeing the debug print I added for the start button press.

Best I can tell is the signal isn't being emitted.

  • Debugger is giving me "Standalone expression (the line may have no effect)." for my start_game.emit line, but it's identical to the finished project (pasting that in also doesn't resolve the bug).

Anyone have an idea what's breaking down?

Here's my _on_start_button_pressed:

func _on_start_button_pressed():
print("Debug: Start Button pressed")
$StartButton.hide()
start_game.emit

Here's my new_game:

func new_game():
print("Debug: new_game called")
score = 0
$Player.start($StartPosition.position)
$StartTimer.start()
$HUD.update_score(score)
$HUD.show_message("Get Ready")

Thanks in advance for the help! 😁

molten moat
#

emit is a function, and functions must be called by adding 2 parenthesis at the end.

So start_game.emit() instead of start_game.emit

It should actually show a warning in the Debugger saying that the line does nothing.