4.4
Hi! I am a beginning developer, and I just migrated from RenPy to Godot and I recently completed the Dodge the Creeps tutorial. The original game was working fine, but I wanted to test my understanding by trying to create a win condition when the player survives the creeps for 30 seconds (currently using 10 secs so it’s easier to test). I simply created a WinTimer with a wait time of 10 seconds. I want to display a “Congratulations!” message on timeout, similar to the game over display. I know I could tie the win condition to the score and use a conditional statement, but I figured this would be a quick and easy way to test my understanding (haha). However, nothing appears to happen when I survive for 10 seconds. The game continues normally until I get hit and trigger the game over screen.
I am starting the WinTimer in the _on_start_timer_timeout() function
with the other timers from the tutorial.
As far as I can see, the timeout signal is connected to the correct function ( _on_win_timer_timeout() ), and that function should call the show_wingame() function in the HUD script. I would appreciate any insight on what I may be doing wrong. I just upgraded to 4.4 yesterday, but it wasn’t working in 4.3 either.
Additional info:
I think the source of the problem may be related to the fact that I accidentally detached a script from it’s node when I went to edit my code (I clicked the script icon in the scene tab trying to get to the script, lol. Rookie mistake!) I think by doing that I disconnected the hit signal from the game_over function in the Main script. I tried to reconnect the signal using the Signal tab in the Player node, but instead of connecting to the existing game_over() function in Main, it would create a new game_over() function in the Player script and connect it to that. So, I ended up manually coding the connection, and the game over display started working again, but I wonder if my current problem is somehow related? Or it there is a way to connect a signal from one node to another without having to do it manually? I believe that is what I did originally, as per the tutorial, so I am not sure what changed.
Sharing relevant code, etc. below. You may notice that while the Signal tab shows a connection to an appropriate function, the script doesn’t show the little green symbol by the function that shows that there is a signal connected to that function. This symbol sometimes appears and sometimes doesn’t, it seems arbitrary to me, but I think it might be related to by problem.
After playing around with trying to create a win condition using a conditional statement based on the score. Didn’t work, but when I tried playing the game, I got an error once I hit the 10 second mark. This is not related to the conditional statement, because I noted that out, and I still get the following errors. I am not sure why it didn’t happen when I was testing before (I don’t remember changing anything except adding the function for the conditional statement). Anyway, more info: