官术网_书友最值得收藏!

Game over

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.

主站蜘蛛池模板: 奉贤区| 南皮县| 铜鼓县| 唐山市| 南投县| 顺平县| 东宁县| 天祝| 彰化县| 安岳县| 湘潭市| 自贡市| 普格县| 扎兰屯市| 屯留县| 吴旗县| 平武县| 司法| 祁连县| 宜城市| 汾西县| 南溪县| 桓仁| 睢宁县| 抚顺市| 平顶山市| 柏乡县| 苏尼特右旗| 河间市| 廉江市| 正宁县| 丰镇市| 宁陕县| 方正县| 晋江市| 仙桃市| 永康市| 兴山县| 浮山县| 五峰| 华宁县|