- 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.
推薦閱讀
- Dreamweaver CS3+Flash CS3+Fireworks CS3創(chuàng)意網(wǎng)站構(gòu)建實例詳解
- Microsoft Power BI Quick Start Guide
- Machine Learning for Cybersecurity Cookbook
- Mastercam 2017數(shù)控加工自動編程經(jīng)典實例(第4版)
- AWS:Security Best Practices on AWS
- TestStand工業(yè)自動化測試管理(典藏版)
- Mastering D3.js
- 工業(yè)機器人工程應用虛擬仿真教程:MotoSim EG-VRC
- WordPress Theme Development Beginner's Guide(Third Edition)
- 具比例時滯遞歸神經(jīng)網(wǎng)絡的穩(wěn)定性及其仿真與應用
- Photoshop行業(yè)應用基礎(chǔ)
- 單片機技能與實訓
- 大數(shù)據(jù)案例精析
- 網(wǎng)絡服務器搭建與管理
- AVR單片機工程師是怎樣煉成的