0 votes

I am running through the "My first game" tutorial and I am getting close to the end of the project. I'm stuck at the conclusion of the HUD section. The tutorial had me create a function: "func showgameover():". Then it asked me to "connect the timeout() signal of MessageTimer and the pressed() signal of StartButton and add the following code to the new functions:"

func _on_StartButton_pressed():
    $StartButton.hide()
    emit_signal("start_game")

func _on_MessageTimer_timeout():
    $Message.hide()

The problem is that I dont know how to connect the "timeout()" signal of MessageTimer to the pressed() signal of StartButton. I feel like something is missing here. At first I missed this part and entered the two functions above without creating a connection to the signal because I couldnt find a signal to connect, but I think I need to make a signal connection somehow because when I run the game, the startbutton does not work and the "Get Ready" messages overlays the game title as the below screenshot shows:

enter image description here

Attached is also the editor screen of where I am at in the code, and a screen shot of a section of tutorial where i'm stuck.
enter image description here
enter image description here

Thank you in advanced for your help. I tried to be as descriptive as possible without making this post too complicated.

Godot version 3.2.3 stable offical
in Engine by (28 points)

1 Answer

0 votes

Select MessageTimer in left panel (you should open HUD scene, or where that timer is located) and in the right panel, you'll see list of Signals... under the Node tab.

In the code printscreen you've provided there are signals for HUD node visible.

Timer will have a timeout() signal... double left click on it and it will open a pop-up window where you can connect it to function.

by (195 points)

Ok I did not know that I had to have the HUD scene selected for this. But all it did was add a new function "pressed()" and I do not know what to do at this point in relationship to the below instructions:

Connect the timeout() signal of MessageTimer and the pressed() signal of StartButton and add the following code to the new functions:

func _on_StartButton_pressed():
    $StartButton.hide()
    emit_signal("start_game")

func _on_MessageTimer_timeout():
    $Message.hide()

Screenshot of my editor of the situation:
enter image description here

I've never done that tutorial, so I might be wrong, but it wants you to do two different conenctions.

You've connected timeout() signal to a pressed() functions which is wrong

Tutorial says:
Connect the timeout() signal of MessageTimer
and the pressed() signal of StartButton
and add the following code to the new functions:

So my take is that you should paste provided code into a HUD script:

func _on_StartButton_pressed():
    $StartButton.hide()
    emit_signal("start_game")

func _on_MessageTimer_timeout():
    $Message.hide()

And do 2 connections.
MessageTimer.timout() signal to onMessageTimertimeout() function
and StartButton.pressed() signal to _on
StartButton_pressed() function

Alright so I was able to connect those signals correctly but I'm still stuck. I'm near the end of this tutorial. Im at the end of the HUD section and am attempting to test the game. The game starts with the message "Get Ready" overlays the "Dodge the Creeps". When I press the start button and the text stays on the screen and the mob function executes correctly, but I do not see the player load into the game. The screenshots of the gotdot editor and the debug screen are below:
Godot Engine Editor Window

Game Debug Screen

I compared all of the gd scripts with the working gd scripts from the tutorial and everything looks ok. At this point I am not sure where the problem is. The dubber screen shows one error but I dont think its related:

W 0:00:00.395   The argument 'body' is never used in the function '_on_Player_body_entered'. If this is intended, prefix it with an underscore: '_body'
  <C++ Error>   UNUSED_ARGUMENT
  <Source>      Player.gd:47

Also the main scene is selected in the project settings...

Im at a loss at this point what is causing the problem. Please let me know If I need to add anything else to this question to help understand why the game is not running correctly.

That warning is not important.

In screenshoot I see:
_on_StartButton_pressed():

which is emitting a "start_game" signal.
Is this signal connected? There has to be something that is listening to this signal and will spawn a player character.

Without full code I can only guess.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.