June 2018
Beginner to intermediate
298 pages
7h 38m
English
The final task for your UI is to react to the game ending:
func show_game_over(): show_message("Game Over") yield($MessageTimer, "timeout") $StartButton.show() $MessageLabel.text = "Coin Dash!" $MessageLabel.show()
In this function, you need the Game Over message to be displayed for two seconds and then disappear, which is what show_message() does. However, you also want to show the start button once the message has disappeared. The yield() function pauses execution of the function until the given node (MessageTimer) emits a given signal (timeout). Once the signal is received, the function continues, returning you to the initial state so that you can play again.
Read now
Unlock full access