Dont know how to fix this tutorial error

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

Hi, Im following the tutorial (your first 2d game) and I almost finished it but now I dont get a game over message once the chararacter dies. And I get this Error:
E 0:00:06.685 emit_signal: Error calling method from signal ‘hit’: ‘Area2D(’: Method not found…

I dont know how to fix it.
Download my files:

:bust_in_silhouette: Reply From: spaceyjase

The player’s ‘hit’ signal is mapped to itself; you can see this in the editor on the ‘Node’ tab when the player is selected. I think it should be mapped to the ‘Main’ node as that has the game_over method. To fix it, go into the player scene and disconnect the signal. Reconnect the signal in the Main scene.

When connected, you can confirm it calls the correct method by double-clicking the signal and godot will open the code editor at the right method.

Thank you so much this fixed it!

Jipiee | 2023-04-22 18:05

:bust_in_silhouette: Reply From: jgodfrey

I’m not overly familiar with the tutorial but it looks like you’ve attempted to connect the hit signal on the Player node to a non-existent game_over() function in the script.

Instead, I think you want to connect that signal to the EXISTING game_over() function found in the script.

You can fix that by right-clicking the errant signal (in the Signals tab), selecting Edit, and selecting the Main node in the dialog that opens.

Thank you so much this fixed it!

Jipiee | 2023-04-22 18:05