- Godot Engine Game Development Projects
- Chris Bradfield
- 160字
- 2021-06-18 18:51:31
Using buttons
Add a Button node and change its name to StartButton. This button will be displayed before the game starts, and when clicked, it will hide itself and send a signal to the Main scene to start the game. Set the Text property to Start and change the custom font like you did with the MessageLabel. In the Layout menu, choose Center Bottom. This will put the button at the very bottom of the screen, so move it up a little bit either by pressing the Up arrow key or by editing the margins and setting Top to -150 and Bottom to -50.
When a button is clicked, a signal is sent out. In the Node tab for the StartButton, connect the pressed() signal:
func _on_StartButton_pressed():
$StartButton.hide()
$MessageLabel.hide()
emit_signal("start_game")
The HUD emits the start_game signal to notify Main that it's time to start a new game.
推薦閱讀
- Instant Raspberry Pi Gaming
- Mastering Mesos
- Design for the Future
- Hands-On Artificial Intelligence on Amazon Web Services
- 會(huì)聲會(huì)影X5視頻剪輯高手速成
- 協(xié)作機(jī)器人技術(shù)及應(yīng)用
- 精通Excel VBA
- 3D Printing for Architects with MakerBot
- Lightning Fast Animation in Element 3D
- LMMS:A Complete Guide to Dance Music Production Beginner's Guide
- IBM? SmartCloud? Essentials
- 智能制造系統(tǒng)及關(guān)鍵使能技術(shù)
- Natural Language Processing and Computational Linguistics
- 大數(shù)據(jù):引爆新的價(jià)值點(diǎn)
- 案例解說Delphi典型控制應(yīng)用