- Godot Engine Game Development Projects
- Chris Bradfield
- 102字
- 2021-06-18 18:51:31
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.
推薦閱讀
- Dreamweaver 8中文版商業案例精粹
- 大數據改變世界
- OpenStack Cloud Computing Cookbook(Second Edition)
- Implementing Oracle API Platform Cloud Service
- 可編程序控制器應用實訓(三菱機型)
- 高維聚類知識發現關鍵技術研究及應用
- RedHat Linux用戶基礎
- 自動化生產線安裝與調試(三菱FX系列)(第二版)
- 簡明學中文版Photoshop
- Mastering Ansible(Second Edition)
- C#求職寶典
- PostgreSQL 10 High Performance
- PostgreSQL High Performance Cookbook
- Python語言從入門到精通
- Flash CS3動畫制作